summaryrefslogtreecommitdiffstats
path: root/sw/qa/uitest/writer_tests2
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /sw/qa/uitest/writer_tests2
parentInitial commit. (diff)
downloadlibreoffice-upstream.tar.xz
libreoffice-upstream.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/qa/uitest/writer_tests2')
-rw-r--r--sw/qa/uitest/writer_tests2/asianPhoneticGuide.py50
-rw-r--r--sw/qa/uitest/writer_tests2/bookmark.py139
-rw-r--r--sw/qa/uitest/writer_tests2/deleteAllComments.py54
-rw-r--r--sw/qa/uitest/writer_tests2/documentProperties.py118
-rw-r--r--sw/qa/uitest/writer_tests2/exchangeDatabase.py58
-rw-r--r--sw/qa/uitest/writer_tests2/formatBulletsNumbering.py293
-rw-r--r--sw/qa/uitest/writer_tests2/formatCharacter.py287
-rw-r--r--sw/qa/uitest/writer_tests2/formatParagraph.py685
-rw-r--r--sw/qa/uitest/writer_tests2/horizontalLine.py42
-rw-r--r--sw/qa/uitest/writer_tests2/insertFootnote.py38
-rw-r--r--sw/qa/uitest/writer_tests2/tdf116474.py54
11 files changed, 1818 insertions, 0 deletions
diff --git a/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py b/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py
new file mode 100644
index 000000000..4722541e6
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py
@@ -0,0 +1,50 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict
+import time
+from uitest.debug import sleep
+from uitest.uihelper.common import select_pos
+
+class asianPhoneticGuide(UITestCase):
+
+ def test_asian_phonetic_guide(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_modeless_dialog_through_command(".uno:RubyDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xLeft1ED = xDialog.getChild("Left1ED")
+ xRight1ED = xDialog.getChild("Right1ED")
+ xadjustlb = xDialog.getChild("adjustlb")
+ xpositionlb = xDialog.getChild("positionlb")
+ xstylelb = xDialog.getChild("stylelb")
+
+ xLeft1ED.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
+ xRight1ED.executeAction("TYPE", mkPropertyValues({"TEXT":"w"}))
+ props = {"TEXT": "Right"}
+ actionProps = mkPropertyValues(props)
+ xadjustlb.executeAction("SELECT", actionProps)
+ props2 = {"TEXT": "Right"}
+ actionProps2 = mkPropertyValues(props2)
+ xpositionlb.executeAction("SELECT", actionProps2)
+ props3 = {"TEXT": "Quotation"}
+ actionProps3 = mkPropertyValues(props3)
+ xstylelb.executeAction("SELECT", actionProps3)
+
+ xApplyBtn = xDialog.getChild("ok")
+ xApplyBtn.executeAction("CLICK", tuple())
+
+ xCloseBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
+
+ self.assertEqual(document.Text.String[0:1], "a")
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/bookmark.py b/sw/qa/uitest/writer_tests2/bookmark.py
new file mode 100644
index 000000000..9cbf82c29
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/bookmark.py
@@ -0,0 +1,139 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# 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/.
+#
+
+from uitest.framework import UITestCase
+import time
+from uitest.uihelper.common import get_state_as_dict, type_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.debug import sleep
+#test bookmark dialog
+class bookmarkDialog(UITestCase):
+
+ def test_bookmark_dialog(self):
+
+ self.ui_test.create_doc_in_start_center("writer")
+
+ self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
+ xBookDlg = self.xUITest.getTopFocusWindow()
+ xInsertBtn = xBookDlg.getChild("insert")
+ xInsertBtn.executeAction("CLICK", tuple()) # first bookmark
+
+ self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
+ xBookDlg = self.xUITest.getTopFocusWindow()
+ xInsertBtn = xBookDlg.getChild("insert")
+ xBmk = xBookDlg.getChild("bookmarks")
+ self.assertEqual(get_state_as_dict(xBmk)["VisibleCount"], "1") #check for 1st bookmark exist
+ xInsertBtn.executeAction("CLICK", tuple()) # add 2nd bookmark
+
+ self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
+ xBookDlg = self.xUITest.getTopFocusWindow()
+ xCloseBtn = xBookDlg.getChild("close")
+ xCloseBtn.executeAction("CLICK", tuple()) # close
+
+ self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
+ xBookDlg = self.xUITest.getTopFocusWindow()
+ xBmk = xBookDlg.getChild("bookmarks")
+ self.assertEqual(get_state_as_dict(xBmk)["VisibleCount"], "2") #check for 2 bookmarks
+ xCloseBtn = xBookDlg.getChild("close")
+ xCloseBtn.executeAction("CLICK", tuple()) # close dialog
+
+#now delete one bookmark
+ self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
+ xBookDlg = self.xUITest.getTopFocusWindow()
+ xBmk = xBookDlg.getChild("bookmarks")
+ xSecondListEntry = xBmk.getChild("1") # select second bookmark
+ xSecondListEntry.executeAction("SELECT", tuple())
+ xDelBtn = xBookDlg.getChild("delete")
+ xDelBtn.executeAction("CLICK", tuple()) # delete one bookmark
+ xCloseBtn = xBookDlg.getChild("close")
+ xCloseBtn.executeAction("CLICK", tuple()) # close dialog
+
+ self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
+ xBookDlg = self.xUITest.getTopFocusWindow()
+ xCloseBtn = xBookDlg.getChild("close")
+ xBmk2 = xBookDlg.getChild("bookmarks")
+ self.assertEqual(get_state_as_dict(xBmk2)["VisibleCount"], "1") #check for 1 bookmark
+ xCloseBtn.executeAction("CLICK", tuple()) # now we have only 1 bookmark
+
+ self.ui_test.close_doc()
+
+
+
+ def test_bookmark_dialog_rename(self):
+ self.ui_test.create_doc_in_start_center("writer")
+
+ self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
+ xBookDlg = self.xUITest.getTopFocusWindow()
+ xInsertBtn = xBookDlg.getChild("insert")
+ xInsertBtn.executeAction("CLICK", tuple()) # first bookmark
+
+ self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
+ xBookDlg = self.xUITest.getTopFocusWindow()
+ xBmk = xBookDlg.getChild("bookmarks")
+ xFirstListEntry = xBmk.getChild("0") # select first bookmark
+ xFirstListEntry.executeAction("SELECT", tuple())
+ xRenameBtn = xBookDlg.getChild("rename")
+
+ def handle_rename_dlg(dialog): #handle rename dialog - need special handling
+
+ xNewNameTxt=dialog.getChild("entry")
+ xNewNameTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"newname"}))
+ xOKBtn = dialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.ui_test.execute_blocking_action(xRenameBtn.executeAction, args=('CLICK', ()),
+ dialog_handler=handle_rename_dlg) #close rename dialog with OK button
+
+ xBookDlg = self.xUITest.getTopFocusWindow()
+ x1stListEntry = xBmk.getChild("O") # select first bookmark - name "newname"
+ x1stListEntry.executeAction("SELECT", tuple())
+
+ self.assertEqual(get_state_as_dict(x1stListEntry)["Text"], "1\tnewname\t\tNo\t") #check the new name "newname"
+
+ xCloseBtn = xBookDlg.getChild("close")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
+
+ self.ui_test.close_doc()
+
+ def test_bookmark_dialog_goto(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
+ xBookDlg = self.xUITest.getTopFocusWindow()
+ xInsertBtn = xBookDlg.getChild("insert")
+ xInsertBtn.executeAction("CLICK", tuple()) # first bookmark
+
+
+ type_text(xWriterEdit, "Test for bookmark")
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ type_text(xWriterEdit, "Test2 for bookmark")
+
+
+ self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
+ xBookDlg = self.xUITest.getTopFocusWindow()
+ xInsertBtn = xBookDlg.getChild("insert")
+ xInsertBtn.executeAction("CLICK", tuple()) # second bookmark
+
+ self.ui_test.execute_dialog_through_command(".uno:InsertBookmark")
+ xBookDlg = self.xUITest.getTopFocusWindow()
+ xBmk = xBookDlg.getChild("bookmarks")
+ xFirstListEntry = xBmk.getChild("0") # select first bookmark
+ xFirstListEntry.executeAction("SELECT", tuple())
+ xGoToBtn = xBookDlg.getChild("goto")
+ xGoToBtn.executeAction("CLICK", tuple()) # goto 1st bookmark
+ xCloseBtn = xBookDlg.getChild("close")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
+
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/deleteAllComments.py b/sw/qa/uitest/writer_tests2/deleteAllComments.py
new file mode 100644
index 000000000..ad9e0c823
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/deleteAllComments.py
@@ -0,0 +1,54 @@
+#
+# 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
+import time
+from uitest.uihelper.common import get_state_as_dict, type_text
+
+class DeleteAllComments(UITestCase):
+
+ def test_comments_delete(self):
+
+ self.ui_test.create_doc_in_start_center("writer")
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+
+ type_text(xWriterEdit, "Test LibreOffice")
+
+ document = self.ui_test.get_component()
+
+ selection = self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+ cursor = document.getCurrentController().getViewCursor()
+ xWriterDoc.executeAction("LEFT", tuple())
+ type_text(xWriterEdit, "EEEEE")
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+ self.xUITest.executeCommand(".uno:DeleteAllNotes")
+ self.assertEqual(document.Text.String[0:4], "Test")
+
+ self.ui_test.close_doc()
+
+ def test_comment_trackchanges(self):
+#tdf111524
+ self.ui_test.create_doc_in_start_center("writer")
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ type_text(xWriterEdit, "foo")
+
+ document = self.ui_test.get_component()
+
+ selection = self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ self.xUITest.executeCommand(".uno:DeleteAllNotes")
+
+
+
+ self.ui_test.close_doc()
diff --git a/sw/qa/uitest/writer_tests2/documentProperties.py b/sw/qa/uitest/writer_tests2/documentProperties.py
new file mode 100644
index 000000000..40366d230
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/documentProperties.py
@@ -0,0 +1,118 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# 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/.
+#
+
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict
+import time
+from uitest.debug import sleep
+from uitest.uihelper.common import select_pos
+
+
+class documentProperties(UITestCase):
+
+ def test_open_documentProperties_writer(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xResetBtn = xDialog.getChild("reset")
+ xResetBtn.executeAction("CLICK", tuple())
+
+ xUserDataCheckbox = xDialog.getChild("userdatacb") # apply user data
+ xUserDataCheckbox.executeAction("CLICK", tuple())
+ xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb") # save preview image with document
+ xThumbSaveCheckbox.executeAction("CLICK", tuple())
+
+#digital signature
+ xDigSignBtn = xDialog.getChild("signature")
+
+ def handle_sign_dlg(dialog):
+ xNoBtn = dialog.getChild("no")
+ self.ui_test.close_dialog_through_button(xNoBtn)
+
+ self.ui_test.execute_blocking_action(xDigSignBtn.executeAction, args=('CLICK', ()),
+ dialog_handler=handle_sign_dlg)
+
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1") #tab Description
+
+ xTitleText = xDialog.getChild("title")
+ xTitleText.executeAction("TYPE", mkPropertyValues({"TEXT":"Title text"}))
+ xSubjectText = xDialog.getChild("subject")
+ xSubjectText.executeAction("TYPE", mkPropertyValues({"TEXT":"Subject text"}))
+ xKeywordsText = xDialog.getChild("keywords")
+ xKeywordsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Keywords text"}))
+ xCommentsText = xDialog.getChild("comments")
+ xCommentsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Comments text"}))
+
+
+#Font tab
+ select_pos(xTabs, "4") #tab Fonts
+ xFontEmbedCheckbox = xDialog.getChild("embedFonts")
+ xFontEmbedCheckbox.executeAction("CLICK", tuple())
+
+#Security tab
+ select_pos(xTabs, "3") #tab Security
+ xReadOnlyCheckbox = xDialog.getChild("readonly")
+ xReadOnlyCheckbox.executeAction("CLICK", tuple())
+ xRecordChangesCheckbox = xDialog.getChild("recordchanges")
+ xRecordChangesCheckbox.executeAction("CLICK", tuple())
+ xProtectBtn = xDialog.getChild("protect")
+ def handle_protect_dlg(dialog):
+ xOkBtn = dialog.getChild("ok")
+ xPasswordText = dialog.getChild("pass1ed")
+ xPasswordText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"}))
+ xConfirmText = dialog.getChild("confirm1ed")
+ xConfirmText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"}))
+ self.ui_test.close_dialog_through_button(xOkBtn)
+
+ self.ui_test.execute_blocking_action(xProtectBtn.executeAction, args=('CLICK', ()),
+ dialog_handler=handle_protect_dlg)
+
+ select_pos(xTabs, "2") #tab Custom properties
+#add custom properties ------>>>>>>>>>>> not supported
+ xAddBtn = xDialog.getChild("add")
+ xAddBtn.executeAction("CLICK", tuple())
+
+ select_pos(xTabs, "5") #tab Statistics
+ xUpdateBtn = xDialog.getChild("update")
+ xUpdateBtn.executeAction("CLICK", tuple())
+
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+#now open the dialog again and read the properties
+ self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTitleText = xDialog.getChild("title")
+ xSubjectText = xDialog.getChild("subject")
+ xKeywordsText = xDialog.getChild("keywords")
+ xCommentsText = xDialog.getChild("comments")
+ xReadOnlyCheckbox = xDialog.getChild("readonly")
+ xRecordChangesCheckbox = xDialog.getChild("recordchanges")
+ xFontEmbedCheckbox = xDialog.getChild("embedFonts")
+ xUserDataCheckbox = xDialog.getChild("userdatacb")
+ xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb")
+ self.assertEqual(get_state_as_dict(xTitleText)["Text"], "Title text")
+ self.assertEqual(get_state_as_dict(xSubjectText)["Text"], "Subject text")
+ self.assertEqual(get_state_as_dict(xKeywordsText)["Text"], "Keywords text")
+ self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xFontEmbedCheckbox)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xUserDataCheckbox)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xThumbSaveCheckbox)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xCommentsText)["Text"], "Comments text")
+ xResetBtn = xDialog.getChild("reset")
+ xResetBtn.executeAction("CLICK", tuple())
+ xCancBtn = xDialog.getChild("cancel")
+ xCancBtn.executeAction("CLICK", tuple())
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/exchangeDatabase.py b/sw/qa/uitest/writer_tests2/exchangeDatabase.py
new file mode 100644
index 000000000..d255bd152
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/exchangeDatabase.py
@@ -0,0 +1,58 @@
+# -*- 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
+import time
+from uitest.uihelper.common import get_state_as_dict, type_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.debug import sleep
+
+class exchangeDB(UITestCase):
+
+ def test_exchange_database(self):
+
+ self.ui_test.create_doc_in_start_center("writer")
+
+ self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField")
+ xExDBDlg = self.xUITest.getTopFocusWindow()
+ xCloseBtn = xExDBDlg.getChild("close")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
+
+ self.ui_test.close_doc()
+
+ def test_exchange_database2(self):
+
+ self.ui_test.create_doc_in_start_center("writer")
+
+ self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField")
+ xExDBDlg = self.xUITest.getTopFocusWindow()
+ xTreelist = xExDBDlg.getChild("availablelb")
+
+ xLabeldb = xExDBDlg.getChild("dbnameft")
+ self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "[None]")
+
+ xTreeEntry = xTreelist.getChild('0') #Available Databases
+ xTreeEntry.executeAction("EXPAND", tuple()) #Click on the Bibliography
+ xTreeEntry.executeAction("COLLAPSE", tuple())
+ xTreeEntry.executeAction("EXPAND", tuple())
+ xTreeEntry2 = xTreeEntry.getChild('0') #Available Databases
+ xTreeEntry2.executeAction("SELECT", tuple()) #Click on the biblio
+
+ xDefineBtn = xExDBDlg.getChild("ok")
+ xDefineBtn.executeAction("CLICK", tuple())
+
+ self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField")
+ xExDBDlg = self.xUITest.getTopFocusWindow()
+ xLabeldb = xExDBDlg.getChild("dbnameft")
+ self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "Bibliography.biblio")
+
+ xCloseBtn = xExDBDlg.getChild("close")
+ self.ui_test.close_dialog_through_button(xCloseBtn)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
new file mode 100644
index 000000000..0d245b858
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
@@ -0,0 +1,293 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict, type_text
+
+import time
+from uitest.debug import sleep
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import select_pos
+
+class formatBulletsNumbering(UITestCase):
+
+ def test_bullets_and_numbering_dialog_tab_position(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialog = self.xUITest.getTopFocusWindow()
+ xPages = xDialog.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Writer
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General - set millimeters
+ xMetric = xDialog.getChild("metric")
+ props = {"TEXT": "Millimeter"}
+ actionProps = mkPropertyValues(props)
+ xMetric.executeAction("SELECT", actionProps)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xalignedatmf = xDialog.getChild("alignedatmf")
+ xnum2alignlb = xDialog.getChild("num2alignlb")
+ xatmf = xDialog.getChild("atmf")
+ xindentatmf = xDialog.getChild("indentatmf")
+ xokbtn = xDialog.getChild("ok")
+
+ xalignedatmf.executeAction("UP", tuple())
+ props = {"TEXT": "Centered"}
+ actionProps = mkPropertyValues(props)
+ xnum2alignlb.executeAction("SELECT", actionProps)
+ xatmf.executeAction("UP", tuple())
+ xindentatmf.executeAction("UP", tuple())
+
+ self.ui_test.close_dialog_through_button(xokbtn)
+
+ self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xalignedatmf = xDialog.getChild("alignedatmf")
+ xnum2alignlb = xDialog.getChild("num2alignlb")
+ xatmf = xDialog.getChild("atmf")
+ xindentatmf = xDialog.getChild("indentatmf")
+
+ self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "6.5 mm")
+ self.assertEqual(get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered")
+ self.assertEqual(get_state_as_dict(xatmf)["Text"], "12.8 mm")
+ self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "12.8 mm")
+
+ xcancbtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xcancbtn)
+
+ self.ui_test.close_doc()
+
+ def test_bullets_and_numbering_dialog_tab_position2(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xnumfollowedbylb = xDialog.getChild("numfollowedbylb")
+ props = {"TEXT": "Space"}
+ actionProps = mkPropertyValues(props)
+ xnumfollowedbylb.executeAction("SELECT", actionProps)
+
+ xokbtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xokbtn)
+
+ self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xnumfollowedbylb = xDialog.getChild("numfollowedbylb")
+ self.assertEqual(get_state_as_dict(xnumfollowedbylb)["SelectEntryText"], "Space")
+
+ xcancbtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xcancbtn)
+
+ self.ui_test.close_doc()
+
+ def test_bullets_and_numbering_dialog_tab_customize(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+ xnumfmtlb = xDialog.getChild("numfmtlb")
+ xstartat = xDialog.getChild("startat")
+ xcharstyle = xDialog.getChild("charstyle")
+ xprefix = xDialog.getChild("prefix")
+ xsuffix = xDialog.getChild("suffix")
+ xallsame = xDialog.getChild("allsame")
+
+ props = {"TEXT": "A, B, C, ..."}
+ actionProps = mkPropertyValues(props)
+ xnumfmtlb.executeAction("SELECT", actionProps)
+ xstartat.executeAction("UP", tuple())
+ props2 = {"TEXT": "Bullets"}
+ actionProps2 = mkPropertyValues(props2)
+ xcharstyle.executeAction("SELECT", actionProps2)
+ xprefix.executeAction("TYPE", mkPropertyValues({"TEXT":"o"}))
+ xsuffix.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
+ xallsame.executeAction("CLICK", tuple())
+
+ xokbtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xokbtn)
+
+ self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+ xnumfmtlb = xDialog.getChild("numfmtlb")
+ xstartat = xDialog.getChild("startat")
+ xcharstyle = xDialog.getChild("charstyle")
+ xprefix = xDialog.getChild("prefix")
+ xsuffix = xDialog.getChild("suffix")
+ xallsame = xDialog.getChild("allsame")
+
+ self.assertEqual(get_state_as_dict(xnumfmtlb)["SelectEntryText"], "A, B, C, ...")
+ self.assertEqual(get_state_as_dict(xstartat)["Text"], "2")
+ self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "Bullets")
+ self.assertEqual(get_state_as_dict(xprefix)["Text"], "o")
+ self.assertEqual(get_state_as_dict(xsuffix)["Text"], "a")
+ self.assertEqual(get_state_as_dict(xallsame)["Selected"], "true")
+
+ xcancbtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xcancbtn)
+
+ self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xremovebtn = xDialog.getChild("user")
+ self.ui_test.close_dialog_through_button(xremovebtn) #remove new settings, back to default
+
+ self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+ xnumfmtlb = xDialog.getChild("numfmtlb")
+ xstartat = xDialog.getChild("startat")
+ xcharstyle = xDialog.getChild("charstyle")
+ xprefix = xDialog.getChild("prefix")
+ xsuffix = xDialog.getChild("suffix")
+ xallsame = xDialog.getChild("allsame")
+
+ self.assertEqual(get_state_as_dict(xnumfmtlb)["SelectEntryText"], "1, 2, 3, ...")
+ self.assertEqual(get_state_as_dict(xstartat)["Text"], "1")
+ self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "None")
+ self.assertEqual(get_state_as_dict(xprefix)["Text"], "")
+ self.assertEqual(get_state_as_dict(xsuffix)["Text"], ".")
+ self.assertEqual(get_state_as_dict(xallsame)["Selected"], "false")
+
+ xcancbtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xcancbtn)
+
+ self.ui_test.close_doc()
+
+ def test_bullets_and_numbering_tab_move(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialog = self.xUITest.getTopFocusWindow()
+ xPages = xDialog.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Writer
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General - set millimeters
+ xMetric = xDialog.getChild("metric")
+ props = {"TEXT": "Millimeter"}
+ actionProps = mkPropertyValues(props)
+ xMetric.executeAction("SELECT", actionProps)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+
+ xokbtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xokbtn) #create bullets
+
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) #TAB to move indent right
+ self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+ self.assertEqual(indentValue < indentValue2 , True)
+ xcancbtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xcancbtn)
+
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
+ self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+ self.assertEqual(indentValue == indentValue3 , True)
+ xcancbtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xcancbtn)
+
+ self.ui_test.close_doc()
+
+ def test_bullets_and_numbering_button_move(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialog = self.xUITest.getTopFocusWindow()
+ xPages = xDialog.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Writer
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General - set millimeters
+ xMetric = xDialog.getChild("metric")
+ props = {"TEXT": "Millimeter"}
+ actionProps = mkPropertyValues(props)
+ xMetric.executeAction("SELECT", actionProps)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+
+ xokbtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xokbtn) #create bullets
+
+ self.xUITest.executeCommand(".uno:DecrementSubLevels")
+ self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+ self.assertEqual(indentValue < indentValue2 , True)
+ xcancbtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xcancbtn)
+
+ self.xUITest.executeCommand(".uno:IncrementLevel")
+ self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+ self.assertEqual(indentValue == indentValue3 , True)
+ xcancbtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xcancbtn)
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/formatCharacter.py b/sw/qa/uitest/writer_tests2/formatCharacter.py
new file mode 100644
index 000000000..e1da1d2cb
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/formatCharacter.py
@@ -0,0 +1,287 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict, type_text
+
+import time
+from uitest.debug import sleep
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import select_pos
+
+class formatCharacter(UITestCase):
+
+ def test_format_character_tab_font(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+
+ xSizeFont = xDialog.getChild("westsizelb-cjk")
+ xSizeFontEast = xDialog.getChild("eastsizelb")
+ xSizeFontCTL = xDialog.getChild("ctlsizelb")
+ xLangFont = xDialog.getChild("westlanglb-cjk")
+ xLangFontEast = xDialog.getChild("eastlanglb")
+ xLangFontCTL = xDialog.getChild("ctllanglb")
+
+ xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18
+ xSizeFontEast.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xSizeFontEast.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18
+ xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18
+ select_pos(xLangFont, "0")
+ select_pos(xLangFontEast, "0")
+ select_pos(xLangFontCTL, "0")
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
+
+ self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xSizeFont = xDialog.getChild("westsizelb-cjk")
+ xSizeFontEast = xDialog.getChild("eastsizelb")
+ xSizeFontCTL = xDialog.getChild("ctlsizelb")
+ xLangFont = xDialog.getChild("westlanglb-cjk")
+ xLangFontEast = xDialog.getChild("eastlanglb")
+ xLangFontCTL = xDialog.getChild("ctllanglb")
+
+ self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18 pt")
+ self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18 pt")
+ self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18 pt") #check font size
+ self.assertEqual(get_state_as_dict(xLangFont)["Text"], "[None]")
+ self.assertEqual(get_state_as_dict(xLangFontEast)["SelectEntryText"], "[None]")
+ self.assertEqual(get_state_as_dict(xLangFontCTL)["SelectEntryText"], "[None]")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+
+ self.ui_test.close_doc()
+
+ def test_format_character_tab_font_effects(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ xEffects = xDialog.getChild("effectslb")
+ xRelief = xDialog.getChild("relieflb")
+ xHidden = xDialog.getChild("hiddencb")
+ xOverline = xDialog.getChild("overlinelb")
+ xStrikeout = xDialog.getChild("strikeoutlb")
+ xUnderline = xDialog.getChild("underlinelb")
+ xEmphasis = xDialog.getChild("emphasislb")
+ xPosition = xDialog.getChild("positionlb")
+
+ select_pos(xEffects, "1")
+ select_pos(xRelief, "1")
+ xHidden.executeAction("CLICK", tuple())
+ select_pos(xOverline, "1")
+ select_pos(xStrikeout, "1")
+ select_pos(xUnderline, "1")
+ select_pos(xEmphasis, "1")
+ select_pos(xPosition, "1")
+
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
+
+ self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ xEffects = xDialog.getChild("effectslb")
+ xRelief = xDialog.getChild("relieflb")
+ xHidden = xDialog.getChild("hiddencb")
+ xOverline = xDialog.getChild("overlinelb")
+ xStrikeout = xDialog.getChild("strikeoutlb")
+ xUnderline = xDialog.getChild("underlinelb")
+ xEmphasis = xDialog.getChild("emphasislb")
+ xPosition = xDialog.getChild("positionlb")
+
+ self.assertEqual(get_state_as_dict(xEffects)["SelectEntryText"], "UPPERCASE")
+ self.assertEqual(get_state_as_dict(xRelief)["SelectEntryText"], "Embossed")
+ self.assertEqual(get_state_as_dict(xHidden)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xOverline)["SelectEntryText"], "Single")
+ self.assertEqual(get_state_as_dict(xStrikeout)["SelectEntryText"], "Single")
+ self.assertEqual(get_state_as_dict(xUnderline)["SelectEntryText"], "Single")
+ self.assertEqual(get_state_as_dict(xEmphasis)["SelectEntryText"], "Dot")
+ self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "Below text")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+
+ self.ui_test.close_doc()
+
+ def test_format_character_tab_hyperlink(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+
+ xURL = xDialog.getChild("urled")
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT":"libreoffice.org"}))
+ xTexted = xDialog.getChild("texted")
+ xTexted.executeAction("TYPE", mkPropertyValues({"TEXT":"LibreOffice"}))
+ xName = xDialog.getChild("nameed")
+ xName.executeAction("TYPE", mkPropertyValues({"TEXT":"hyperlink"}))
+
+ xVisited = xDialog.getChild("visitedlb")
+ props = {"TEXT": "Bullets"}
+ actionProps = mkPropertyValues(props)
+ xVisited.executeAction("SELECT", actionProps)
+ xUnVisited = xDialog.getChild("unvisitedlb")
+ props = {"TEXT": "Bullets"}
+ actionProps = mkPropertyValues(props)
+ xUnVisited.executeAction("SELECT", actionProps)
+
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+
+ self.xUITest.executeCommand(".uno:GoLeft")
+ self.assertEqual(document.Text.String[0:11], "LibreOffice")
+
+ self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xURL = xDialog.getChild("urled")
+ xTexted = xDialog.getChild("texted")
+ xName = xDialog.getChild("nameed")
+ xVisited = xDialog.getChild("visitedlb")
+ xUnVisited = xDialog.getChild("unvisitedlb")
+
+ self.assertEqual(get_state_as_dict(xURL)["Text"], "http://libreoffice.org/")
+ self.assertEqual(get_state_as_dict(xTexted)["Text"], "LibreOffice")
+ self.assertEqual(get_state_as_dict(xName)["Text"], "hyperlink")
+ self.assertEqual(get_state_as_dict(xVisited)["SelectEntryText"], "Bullets")
+ self.assertEqual(get_state_as_dict(xUnVisited)["SelectEntryText"], "Bullets")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+ self.ui_test.close_doc()
+
+ def test_format_character_tab_asian_layout(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3")
+
+ xTwolines = xDialog.getChild("twolines")
+ xTwolines.executeAction("CLICK", tuple())
+
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+
+ self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3")
+ xTwolines = xDialog.getChild("twolines")
+
+ self.assertEqual(get_state_as_dict(xTwolines)["Selected"], "true")
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+ self.ui_test.close_doc()
+
+ def test_format_character_tab_position(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+
+ xSuperscript = xDialog.getChild("superscript")
+ xRelFontSize = xDialog.getChild("fontsizesb")
+ x90deg = xDialog.getChild("90deg")
+ xScalewidth = xDialog.getChild("scalewidthsb")
+ xKerning = xDialog.getChild("kerningsb")
+ xPairKerning = xDialog.getChild("pairkerning")
+ xFitToLine = xDialog.getChild("fittoline")
+
+ xSuperscript.executeAction("CLICK", tuple())
+ xRelFontSize.executeAction("UP", tuple())
+ x90deg.executeAction("CLICK", tuple())
+ xScalewidth.executeAction("UP", tuple())
+ xKerning.executeAction("UP", tuple())
+ xPairKerning.executeAction("CLICK", tuple())
+ xFitToLine.executeAction("CLICK", tuple())
+
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+
+ self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+ xSuperscript = xDialog.getChild("superscript")
+ xRelFontSize = xDialog.getChild("fontsizesb")
+ x90deg = xDialog.getChild("90deg")
+ xScalewidth = xDialog.getChild("scalewidthsb")
+ xKerning = xDialog.getChild("kerningsb")
+ xPairKerning = xDialog.getChild("pairkerning")
+ xFitToLine = xDialog.getChild("fittoline")
+
+ self.assertEqual(get_state_as_dict(xSuperscript)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(x90deg)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "100%")
+ self.assertEqual(get_state_as_dict(xKerning)["Text"], "0.1 pt")
+ self.assertEqual(get_state_as_dict(xPairKerning)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xFitToLine)["Selected"], "true")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+
+ self.ui_test.close_doc()
+
+ def test_format_character_tab_position_scalewidthsb(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+
+ xScalewidth = xDialog.getChild("scalewidthsb")
+ xScalewidth.executeAction("UP", tuple())
+
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+
+ self.ui_test.execute_dialog_through_command(".uno:FontDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+ xScalewidth = xDialog.getChild("scalewidthsb")
+ self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "101%")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/formatParagraph.py b/sw/qa/uitest/writer_tests2/formatParagraph.py
new file mode 100644
index 000000000..cd07db9a1
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/formatParagraph.py
@@ -0,0 +1,685 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict, type_text
+
+import time
+from uitest.debug import sleep
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import select_pos
+
+class formatParagraph(UITestCase):
+
+ def test_format_paragraph_tab_indents_spacing(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+
+ xBeforeText = xDialog.getChild("spinED_LEFTINDENT")
+ xAfterText = xDialog.getChild("spinED_RIGHTINDENT")
+ xFirstLine = xDialog.getChild("spinED_FLINEINDENT")
+ xAutomaticChk = xDialog.getChild("checkCB_AUTO")
+ xAbovePar = xDialog.getChild("spinED_TOPDIST")
+ xBelowPar = xDialog.getChild("spinED_BOTTOMDIST")
+ xChkspace = xDialog.getChild("checkCB_CONTEXTUALSPACING")
+ xLineSpacing = xDialog.getChild("comboLB_LINEDIST")
+ xActivate = xDialog.getChild("checkCB_REGISTER")
+
+ xBeforeText.executeAction("UP", tuple())
+ xAfterText.executeAction("UP", tuple())
+ xFirstLine.executeAction("UP", tuple())
+ xAutomaticChk.executeAction("CLICK", tuple())
+ xAbovePar.executeAction("UP", tuple())
+ xBelowPar.executeAction("UP", tuple())
+ xChkspace.executeAction("CLICK", tuple())
+ props = {"TEXT": "Double"}
+ actionProps = mkPropertyValues(props)
+ xLineSpacing.executeAction("SELECT", actionProps)
+ xActivate.executeAction("CLICK", tuple())
+
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xBeforeText = xDialog.getChild("spinED_LEFTINDENT")
+ xAfterText = xDialog.getChild("spinED_RIGHTINDENT")
+ xFirstLine = xDialog.getChild("spinED_FLINEINDENT")
+ xAutomaticChk = xDialog.getChild("checkCB_AUTO")
+ xAbovePar = xDialog.getChild("spinED_TOPDIST")
+ xBelowPar = xDialog.getChild("spinED_BOTTOMDIST")
+ xChkspace = xDialog.getChild("checkCB_CONTEXTUALSPACING")
+ xLineSpacing = xDialog.getChild("comboLB_LINEDIST")
+ xActivate = xDialog.getChild("checkCB_REGISTER")
+
+ self.assertEqual(get_state_as_dict(xBeforeText)["Text"], "0.50 ch")
+ self.assertEqual(get_state_as_dict(xAfterText)["Text"], "0.50 ch")
+ self.assertEqual(get_state_as_dict(xFirstLine)["Text"], "0.50 ch")
+ self.assertEqual(get_state_as_dict(xAutomaticChk)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xAbovePar)["Text"], "0.50 line")
+ self.assertEqual(get_state_as_dict(xBelowPar)["Text"], "0.50 line")
+ self.assertEqual(get_state_as_dict(xChkspace)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xLineSpacing)["SelectEntryText"], "Double")
+ self.assertEqual(get_state_as_dict(xActivate)["Selected"], "true")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+
+ self.ui_test.close_doc()
+
+ def test_format_paragraph_tab_alignment(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ xTextDirection = xDialog.getChild("comboLB_TEXTDIRECTION")
+ xAlignment = xDialog.getChild("comboLB_VERTALIGN")
+ xSnapToText = xDialog.getChild("checkCB_SNAP")
+ xJustified = xDialog.getChild("radioBTN_JUSTIFYALIGN")
+ xLastLine = xDialog.getChild("comboLB_LASTLINE")
+ xExpandChk = xDialog.getChild("checkCB_EXPAND")
+
+ props = {"TEXT": "Left-to-right (LTR)"}
+ actionProps = mkPropertyValues(props)
+ xTextDirection.executeAction("SELECT", actionProps)
+ props2 = {"TEXT": "Top"}
+ actionProps2 = mkPropertyValues(props2)
+ xAlignment.executeAction("SELECT", actionProps2)
+ xSnapToText.executeAction("CLICK", tuple())
+ xJustified.executeAction("CLICK", tuple())
+ props3 = {"TEXT": "Justified"}
+ actionProps3 = mkPropertyValues(props3)
+ xLastLine.executeAction("SELECT", actionProps3)
+ xExpandChk.executeAction("CLICK", tuple())
+
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ xTextDirection = xDialog.getChild("comboLB_TEXTDIRECTION")
+ xAlignment = xDialog.getChild("comboLB_VERTALIGN")
+ xSnapToText = xDialog.getChild("checkCB_SNAP")
+ xJustified = xDialog.getChild("radioBTN_JUSTIFYALIGN")
+ xLastLine = xDialog.getChild("comboLB_LASTLINE")
+ xExpandChk = xDialog.getChild("checkCB_EXPAND")
+
+ self.assertEqual(get_state_as_dict(xTextDirection)["SelectEntryText"], "Left-to-right (LTR)")
+ self.assertEqual(get_state_as_dict(xAlignment)["SelectEntryText"], "Top")
+ self.assertEqual(get_state_as_dict(xSnapToText)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xJustified)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xLastLine)["SelectEntryText"], "Justified")
+ self.assertEqual(get_state_as_dict(xExpandChk)["Selected"], "true")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+
+ self.ui_test.close_doc()
+
+ def test_format_paragraph_tab_text_flow(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+
+ xAutomaticaly = xDialog.getChild("checkAuto")
+ xEnd = xDialog.getChild("spinLineEnd")
+ xBegin = xDialog.getChild("spinLineBegin")
+ xMax = xDialog.getChild("spinMaxNum")
+ xIns = xDialog.getChild("checkInsert")
+ xType = xDialog.getChild("comboBreakType")
+ xPosition = xDialog.getChild("comboBreakPosition")
+ xspinOrphan = xDialog.getChild("spinOrphan")
+ xspinWidow = xDialog.getChild("spinWidow")
+ xcheckWidow = xDialog.getChild("checkWidow")
+ xcheckOrphan = xDialog.getChild("checkOrphan")
+ xcheckSplitPara = xDialog.getChild("checkSplitPara")
+ xcheckKeepPara = xDialog.getChild("checkKeepPara")
+
+ xAutomaticaly.executeAction("CLICK", tuple())
+ xEnd.executeAction("UP", tuple())
+ xBegin.executeAction("UP", tuple())
+ xMax.executeAction("UP", tuple())
+ xIns.executeAction("CLICK", tuple())
+ props = {"TEXT": "Column"}
+ actionProps = mkPropertyValues(props)
+ xType.executeAction("SELECT", actionProps)
+ props2 = {"TEXT": "After"}
+ actionProps2 = mkPropertyValues(props2)
+ xPosition.executeAction("SELECT", actionProps2)
+ xspinOrphan.executeAction("UP", tuple())
+ xspinWidow.executeAction("UP", tuple())
+ xcheckWidow.executeAction("CLICK", tuple())
+ xcheckOrphan.executeAction("CLICK", tuple())
+ xcheckSplitPara.executeAction("CLICK", tuple())
+ xcheckKeepPara.executeAction("CLICK", tuple())
+
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+
+ xAutomaticaly = xDialog.getChild("checkAuto")
+ xEnd = xDialog.getChild("spinLineEnd")
+ xBegin = xDialog.getChild("spinLineBegin")
+ xMax = xDialog.getChild("spinMaxNum")
+ xIns = xDialog.getChild("checkInsert")
+ xType = xDialog.getChild("comboBreakType")
+ xPosition = xDialog.getChild("comboBreakPosition")
+ xspinOrphan = xDialog.getChild("spinOrphan")
+ xspinWidow = xDialog.getChild("spinWidow")
+ xcheckWidow = xDialog.getChild("checkWidow")
+ xcheckOrphan = xDialog.getChild("checkOrphan")
+ xcheckSplitPara = xDialog.getChild("checkSplitPara")
+ xcheckKeepPara = xDialog.getChild("checkKeepPara")
+
+ self.assertEqual(get_state_as_dict(xAutomaticaly)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xEnd)["Text"], "3")
+ self.assertEqual(get_state_as_dict(xBegin)["Text"], "3")
+ self.assertEqual(get_state_as_dict(xMax)["Text"], "1")
+ self.assertEqual(get_state_as_dict(xIns)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xType)["SelectEntryText"], "Column")
+ self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "After")
+ self.assertEqual(get_state_as_dict(xspinOrphan)["Text"], "2")
+ self.assertEqual(get_state_as_dict(xspinWidow)["Text"], "2")
+ self.assertEqual(get_state_as_dict(xcheckWidow)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xcheckOrphan)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xcheckSplitPara)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xcheckKeepPara)["Selected"], "true")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+
+ self.ui_test.close_doc()
+
+ def test_format_paragraph_tab_asian_typography(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3")
+
+ xcheckForbidList = xDialog.getChild("checkForbidList")
+ xcheckHangPunct = xDialog.getChild("checkHangPunct")
+ xcheckApplySpacing = xDialog.getChild("checkApplySpacing")
+
+ xcheckForbidList.executeAction("CLICK", tuple())
+ xcheckHangPunct.executeAction("CLICK", tuple())
+ xcheckApplySpacing.executeAction("CLICK", tuple())
+
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3")
+
+ xcheckForbidList = xDialog.getChild("checkForbidList")
+ xcheckHangPunct = xDialog.getChild("checkHangPunct")
+ xcheckApplySpacing = xDialog.getChild("checkApplySpacing")
+
+ self.assertEqual(get_state_as_dict(xcheckForbidList)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xcheckHangPunct)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xcheckApplySpacing)["Selected"], "false")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+
+ self.ui_test.close_doc()
+
+ def test_format_paragraph_tab_outline_numbering(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+
+ xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL")
+ xNumbering = xDialog.getChild("comboLB_NUMBER_STYLE")
+ xPara = xDialog.getChild("checkCB_RESTART_PARACOUNT")
+ xParaSpin = xDialog.getChild("spinNF_RESTART_PARA")
+
+ props = {"TEXT": "Level 1"}
+ actionProps = mkPropertyValues(props)
+ xOutline.executeAction("SELECT", actionProps)
+ props2 = {"TEXT": "Bullet •"}
+ actionProps2 = mkPropertyValues(props2)
+ xNumbering.executeAction("SELECT", actionProps2)
+ xPara.executeAction("CLICK", tuple())
+ xParaSpin.executeAction("UP", tuple())
+
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+
+ xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL")
+ xNumbering = xDialog.getChild("comboLB_NUMBER_STYLE")
+ xPara = xDialog.getChild("checkCB_RESTART_PARACOUNT")
+ xParaSpin = xDialog.getChild("spinNF_RESTART_PARA")
+
+ self.assertEqual(get_state_as_dict(xOutline)["SelectEntryText"], "Level 1")
+ self.assertEqual(get_state_as_dict(xNumbering)["SelectEntryText"], "Bullet •")
+ self.assertEqual(get_state_as_dict(xPara)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xParaSpin)["Text"], "2")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+
+ self.ui_test.close_doc()
+
+ def test_format_paragraph_tab_tabs(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialog = self.xUITest.getTopFocusWindow()
+ xPages = xDialog.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Writer
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General
+ xMetric = xDialog.getChild("metric")
+ props = {"TEXT": "Centimeter"}
+ actionProps = mkPropertyValues(props)
+ xMetric.executeAction("SELECT", actionProps)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL")
+ xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR")
+ xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER")
+ xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
+ xED_TABPOS = xDialog.getChild("ED_TABPOS")
+
+ xDecimal.executeAction("CLICK", tuple())
+ xDecimalTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xDecimalTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"i"}))
+ xFill.executeAction("CLICK", tuple())
+ xFillTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xFillTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"p"}))
+ xED_TABPOS.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xED_TABPOS.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+ xNewButtn.executeAction("CLICK", tuple())
+
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL")
+ xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR")
+ xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER")
+ xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
+ xED_TABPOS = xDialog.getChild("ED_TABPOS")
+
+ self.assertEqual(get_state_as_dict(xDecimal)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xDecimalTxt)["Text"], "i")
+ self.assertEqual(get_state_as_dict(xFill)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xFillTxt)["Text"], "p")
+ self.assertEqual(get_state_as_dict(xED_TABPOS)["Text"], "1.00 cm")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER")
+ xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
+
+ xCentered.executeAction("CLICK", tuple())
+ xUnderscore.executeAction("CLICK", tuple())
+ xNewButtn.executeAction("CLICK", tuple())
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER")
+ xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE")
+ self.assertEqual(get_state_as_dict(xCentered)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xUnderscore)["Checked"], "true")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN")
+ xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
+
+ xRight.executeAction("CLICK", tuple())
+ xDashLine.executeAction("CLICK", tuple())
+ xNewButtn.executeAction("CLICK", tuple())
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN")
+ xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE")
+ self.assertEqual(get_state_as_dict(xRight)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xDashLine)["Checked"], "true")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN")
+ xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
+
+ xLeft.executeAction("CLICK", tuple())
+ xPointsLine.executeAction("CLICK", tuple())
+ xNewButtn.executeAction("CLICK", tuple())
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN")
+ xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS")
+ self.assertEqual(get_state_as_dict(xLeft)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xPointsLine)["Checked"], "true")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+
+ self.ui_test.close_doc()
+
+ def test_format_paragraph_tab_drop_caps(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "6")
+
+ xDisplay = xDialog.getChild("checkCB_SWITCH")
+ xWholeWord = xDialog.getChild("checkCB_WORD")
+ xLines = xDialog.getChild("spinFLD_LINES")
+ xSpaceToText = xDialog.getChild("spinFLD_DISTANCE")
+ xText = xDialog.getChild("entryEDT_TEXT")
+ xCharStyle = xDialog.getChild("comboBOX_TEMPLATE")
+
+ xDisplay.executeAction("CLICK", tuple())
+ xWholeWord.executeAction("CLICK", tuple())
+ xLines.executeAction("UP", tuple())
+ xSpaceToText.executeAction("UP", tuple())
+ xText.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
+ props = {"TEXT": "Definition"}
+ actionProps = mkPropertyValues(props)
+ xCharStyle.executeAction("SELECT", actionProps)
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "6")
+
+ xDisplay = xDialog.getChild("checkCB_SWITCH")
+ xWholeWord = xDialog.getChild("checkCB_WORD")
+ xLines = xDialog.getChild("spinFLD_LINES")
+ xSpaceToText = xDialog.getChild("spinFLD_DISTANCE")
+ xText = xDialog.getChild("entryEDT_TEXT")
+ xCharStyle = xDialog.getChild("comboBOX_TEMPLATE")
+
+ self.assertEqual(get_state_as_dict(xDisplay)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xWholeWord)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xText)["Text"], "A")
+ self.assertEqual(get_state_as_dict(xCharStyle)["SelectEntryText"], "Definition")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+
+ self.ui_test.close_doc()
+
+ def test_format_paragraph_tab_borders(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialog = self.xUITest.getTopFocusWindow()
+ xPages = xDialog.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Writer
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General - set centimeter
+ xMetric = xDialog.getChild("metric")
+ props = {"TEXT": "Centimeter"}
+ actionProps = mkPropertyValues(props)
+ xMetric.executeAction("SELECT", actionProps)
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "7")
+
+ xStyle = xDialog.getChild("linestylelb")
+ xwidth = xDialog.getChild("linewidthmf")
+ xSync = xDialog.getChild("sync")
+ xLeft = xDialog.getChild("leftmf")
+ xRight = xDialog.getChild("rightmf")
+ xTop = xDialog.getChild("topmf")
+ xBottom = xDialog.getChild("bottommf")
+ xMerge = xDialog.getChild("mergewithnext")
+
+ select_pos(xStyle, "1")
+ xwidth.executeAction("UP", tuple())
+ xSync.executeAction("CLICK", tuple())
+ xLeft.executeAction("UP", tuple())
+ xLeft.executeAction("UP", tuple())
+ xRight.executeAction("UP", tuple())
+ xTop.executeAction("UP", tuple())
+ xBottom.executeAction("UP", tuple())
+ xMerge.executeAction("CLICK", tuple())
+
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "7")
+
+ xStyle = xDialog.getChild("linestylelb")
+ xwidth = xDialog.getChild("linewidthmf")
+ xSync = xDialog.getChild("sync")
+ xLeft = xDialog.getChild("leftmf")
+ xRight = xDialog.getChild("rightmf")
+ xTop = xDialog.getChild("topmf")
+ xBottom = xDialog.getChild("bottommf")
+ xMerge = xDialog.getChild("mergewithnext")
+
+ self.assertEqual(get_state_as_dict(xSync)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xMerge)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xLeft)["Text"], "0.20 cm")
+ self.assertEqual(get_state_as_dict(xRight)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(xTop)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(xBottom)["Text"], "0.10 cm")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+ self.ui_test.close_doc()
+
+ def test_format_paragraph_area(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "8")
+
+ xColor = xDialog.getChild("btncolor")
+ xGradient = xDialog.getChild("btngradient")
+ xBitmap = xDialog.getChild("btnbitmap")
+ xPattern = xDialog.getChild("btnpattern")
+ xHatch = xDialog.getChild("btnhatch")
+
+ xColor.executeAction("CLICK", tuple())
+ xGradient.executeAction("CLICK", tuple())
+ xBitmap.executeAction("CLICK", tuple())
+ xPattern.executeAction("CLICK", tuple())
+ xHatch.executeAction("CLICK", tuple())
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+ self.ui_test.close_doc()
+
+ def test_format_paragraph_transparency(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "9")
+
+ xTran = xDialog.getChild("RBT_TRANS_LINEAR")
+ xTranText = xDialog.getChild("MTR_TRANSPARENT")
+
+ xTran.executeAction("CLICK", tuple())
+ xTranText.executeAction("UP", tuple())
+
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "9")
+
+ xTran = xDialog.getChild("RBT_TRANS_LINEAR")
+ xTranText = xDialog.getChild("MTR_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xTran)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xTranText)["Text"], "51%")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "9")
+
+ xGradient = xDialog.getChild("RBT_TRANS_GRADIENT")
+ xType = xDialog.getChild("LB_TRGR_GRADIENT_TYPES")
+ xAngle = xDialog.getChild("MTR_TRGR_ANGLE")
+ xBorder = xDialog.getChild("MTR_TRGR_BORDER")
+ xStart = xDialog.getChild("MTR_TRGR_START_VALUE")
+ xEnd = xDialog.getChild("MTR_TRGR_END_VALUE")
+
+ xGradient.executeAction("CLICK", tuple())
+ props = {"TEXT": "Axial"}
+ actionProps = mkPropertyValues(props)
+ xType.executeAction("SELECT", actionProps)
+ xAngle.executeAction("UP", tuple())
+ xBorder.executeAction("UP", tuple())
+ xStart.executeAction("UP", tuple())
+ xEnd.executeAction("UP", tuple())
+
+ xOK = xDialog.getChild("ok")
+ xOK.executeAction("CLICK", tuple())
+
+ self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "9")
+
+ xGradient = xDialog.getChild("RBT_TRANS_GRADIENT")
+ xType = xDialog.getChild("LB_TRGR_GRADIENT_TYPES")
+ xAngle = xDialog.getChild("MTR_TRGR_ANGLE")
+ xBorder = xDialog.getChild("MTR_TRGR_BORDER")
+ xStart = xDialog.getChild("MTR_TRGR_START_VALUE")
+ xEnd = xDialog.getChild("MTR_TRGR_END_VALUE")
+
+ self.assertEqual(get_state_as_dict(xGradient)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xType)["SelectEntryText"], "Axial")
+ self.assertEqual(get_state_as_dict(xAngle)["Text"], "1°")
+ self.assertEqual(get_state_as_dict(xBorder)["Text"], "1%")
+ self.assertEqual(get_state_as_dict(xStart)["Text"], "1%")
+ self.assertEqual(get_state_as_dict(xEnd)["Text"], "1%")
+
+ xCanc = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanc)
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/horizontalLine.py b/sw/qa/uitest/writer_tests2/horizontalLine.py
new file mode 100644
index 000000000..c102f6031
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/horizontalLine.py
@@ -0,0 +1,42 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict, type_text
+from uitest.debug import sleep
+
+class WriterInsertHorizontalLine(UITestCase):
+
+ def test_insert_horizontal_line(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ type_text(xWriterEdit, "Test horizontal line") #write the text
+
+ self.xUITest.executeCommand(".uno:StyleApply?Style:string=Horizontal%20Line&FamilyName:string=ParagraphStyles") #insert horizontal line
+
+ self.ui_test.execute_dialog_through_command(".uno:EditStyle") #open style dialog
+ xDialog = self.xUITest.getTopFocusWindow()
+ xStyleNametxt = xDialog.getChild("name")
+ self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name
+ xCancBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancBtn)
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Redo")
+
+ self.ui_test.execute_dialog_through_command(".uno:EditStyle") #open style dialog
+ xDialog = self.xUITest.getTopFocusWindow()
+ xStyleNametxt = xDialog.getChild("name")
+ self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name
+ xCancBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancBtn)
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/insertFootnote.py b/sw/qa/uitest/writer_tests2/insertFootnote.py
new file mode 100644
index 000000000..6bd4db73f
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/insertFootnote.py
@@ -0,0 +1,38 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict, type_text
+import time
+from uitest.debug import sleep
+
+class insertFootnote(UITestCase):
+
+ def test_insert_footnote(self):
+ self.ui_test.create_doc_in_start_center("writer")
+ document = self.ui_test.get_component()
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.xUITest.executeCommand(".uno:InsertFootnote")
+
+ type_text(xWriterEdit, "LibreOffice")
+ self.assertEqual(document.Footnotes[0].String, "LibreOffice")
+ self.assertEqual(document.Footnotes.getCount(), 1)
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Footnotes[0].String, "")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Footnotes.getCount(), 0)
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(document.Footnotes[0].String, "")
+ self.assertEqual(document.Footnotes.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(document.Footnotes[0].String, "LibreOffice")
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/tdf116474.py b/sw/qa/uitest/writer_tests2/tdf116474.py
new file mode 100644
index 000000000..e5bb89209
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/tdf116474.py
@@ -0,0 +1,54 @@
+# -*- 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()
+ 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])
+
+ 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[0]
+ self.assertEqual(document.TextFrames[0].Text.String, "Figure 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[0].Text.String, "Figure 1: Caption")
+ self.assertEqual(document.GraphicObjects.getCount(), 1) #nr. of images
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab: