diff options
Diffstat (limited to 'sw/qa/uitest/navigator')
-rw-r--r-- | sw/qa/uitest/navigator/tdf114724.py | 56 | ||||
-rw-r--r-- | sw/qa/uitest/navigator/tdf134960.py | 81 | ||||
-rw-r--r-- | sw/qa/uitest/navigator/tdf137274.py | 70 | ||||
-rw-r--r-- | sw/qa/uitest/navigator/tdf140257.py | 112 | ||||
-rw-r--r-- | sw/qa/uitest/navigator/tdf140661.py | 64 | ||||
-rw-r--r-- | sw/qa/uitest/navigator/tdf143569.py | 69 | ||||
-rw-r--r-- | sw/qa/uitest/navigator/tdf144672.py | 55 | ||||
-rw-r--r-- | sw/qa/uitest/navigator/tdf148198.py | 61 | ||||
-rw-r--r-- | sw/qa/uitest/navigator/tdf149268.py | 43 | ||||
-rw-r--r-- | sw/qa/uitest/navigator/tdf40427.py | 77 |
10 files changed, 688 insertions, 0 deletions
diff --git a/sw/qa/uitest/navigator/tdf114724.py b/sw/qa/uitest/navigator/tdf114724.py new file mode 100644 index 000000000..841c9f121 --- /dev/null +++ b/sw/qa/uitest/navigator/tdf114724.py @@ -0,0 +1,56 @@ +# -*- 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, get_url_for_data_file + +class tdf114724(UITestCase): + + def test_track_headings_outline(self): + with self.ui_test.load_file(get_url_for_data_file("tdf114724.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel") + xToolBar = xNavigatorPanel.getChild("content5") + xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'root' button + + xWriterEdit.executeAction("FOCUS", tuple()) + + xContentTree = xNavigatorPanel.getChild("contenttree") + + self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 1") + self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 1") + self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1") + for _ in range(0,3): + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + + self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 4") + self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 4") + self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1") + + for _ in range(0,3): + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + + self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 1") + self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 1") + self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1") + + # tdf#124456 makes the sidebar navigator consistent with the floating navigator's use + # of the stored root mode setting. This requires the root mode button to be clicked + # here to change the content navigation view back to all categories view for subsequent + # tests that expect the navigator tree to not be in root mode. + xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'root' button + self.xUITest.executeCommand(".uno:Sidebar") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf134960.py b/sw/qa/uitest/navigator/tdf134960.py new file mode 100644 index 000000000..de5da7759 --- /dev/null +++ b/sw/qa/uitest/navigator/tdf134960.py @@ -0,0 +1,81 @@ +# -*- 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, get_url_for_data_file + +class tdf134960_hyperlinks(UITestCase): + + def launch_sidebar(self, xWriterEdit): + + self.xUITest.executeCommand(".uno:Sidebar") + + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + xHyperlinks = xContentTree.getChild('7') + self.assertEqual('Hyperlinks', get_state_as_dict(xHyperlinks)['Text']) + + xHyperlinks.executeAction("EXPAND", tuple()) + + expectedHyperlinksOrder = [1, 2, 8, 9, 7, 10, 11, 3, 12, 4, 5, 6] + for i in range(12): + self.assertEqual('Hyperlink ' + str(expectedHyperlinksOrder[i]), get_state_as_dict(xHyperlinks.getChild(str(i)))['Text']) + + xHyperlinks.executeAction("COLLAPSE", tuple()) + + self.xUITest.executeCommand(".uno:Sidebar") + + def test_tdf134960_hyperlinks(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf134960.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + # Without the fix in place, this test would have failed with + # AssertionError: 'Hyperlink 2' != 'Hyperlink 6' + self.launch_sidebar(xWriterEdit) + + def test_tdf134960_hyperlinks_with_multiple_pages(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf134960.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + # Insert a page break so we have different links in different pages + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + self.xUITest.executeCommand(".uno:InsertPagebreak") + self.assertEqual("3", get_state_as_dict(xWriterEdit)["Pages"]) + + # Change view to 20% and 2 columns + with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog: + variable = xDialog.getChild("variable") + variable.executeAction("CLICK", tuple()) + + zoomsb = xDialog.getChild("zoomsb") + zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + zoomsb.executeAction("TYPE", mkPropertyValues({"TEXT":"20"})) + + columns = xDialog.getChild("columns") + columns.executeAction("CLICK", tuple()) + + columnssb = xDialog.getChild("columnssb") + columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + columnssb.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + + # Without the fix in place, this test would have failed with + # AssertionError: 'Hyperlink 2' != 'Hyperlink 8' + self.launch_sidebar(xWriterEdit) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf137274.py b/sw/qa/uitest/navigator/tdf137274.py new file mode 100644 index 000000000..a25f449ab --- /dev/null +++ b/sw/qa/uitest/navigator/tdf137274.py @@ -0,0 +1,70 @@ +# -*- 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 + +class tdf137274(UITestCase): + + def test_tdf137274(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + xMainWindow = self.xUITest.getTopFocusWindow() + xWriterEdit = xMainWindow.getChild("writer_edit") + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Test"})) + + # Insert first comment + xArgs = mkPropertyValues({"Text": "C1"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + + # wait until the comment is available + self.ui_test.wait_until_child_is_available('Comment1') + + self.xUITest.executeCommand(".uno:Sidebar") + + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + xComments = xContentTree.getChild('10') + self.assertEqual('Comments', get_state_as_dict(xComments)['Text']) + + xComments.executeAction("EXPAND", tuple()) + + self.assertEqual(1, len(xComments.getChildren())) + self.assertEqual('C1', get_state_as_dict(xComments.getChild('0'))['Text']) + + xComments.executeAction("COLLAPSE", tuple()) + + xArgs = mkPropertyValues({"Text": "C2"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + + # wait until the second comment is available + self.ui_test.wait_until_child_is_available('Comment2') + + # xComments needs reassigned after content tree change + xComments = xContentTree.getChild('10') + self.assertEqual('Comments', get_state_as_dict(xComments)['Text']) + + xComments.executeAction("EXPAND", tuple()) + + # Without the fix in place, this test would have failed with AssertionError: 2 != 0 + self.assertEqual(2, len(xComments.getChildren())) + self.assertEqual('C1', get_state_as_dict(xComments.getChild('0'))['Text']) + + xComments.executeAction("COLLAPSE", tuple()) + + self.xUITest.executeCommand(".uno:Sidebar") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf140257.py b/sw/qa/uitest/navigator/tdf140257.py new file mode 100644 index 000000000..fc2787bf0 --- /dev/null +++ b/sw/qa/uitest/navigator/tdf140257.py @@ -0,0 +1,112 @@ +# -*- 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, type_text +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text + +class Tdf140257(UITestCase): + + def change_outline_level(self, sText): + + with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL") + + select_by_text(xOutline, sText) + + + def test_tdf140257(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xMainWindow = self.xUITest.getTopFocusWindow() + xWriterEdit = xMainWindow.getChild("writer_edit") + + self.change_outline_level("Level 1") + + for i in range(4): + type_text(xWriterEdit, 'P' + str(i + 1)) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + type_text(xWriterEdit, 'P5') + + self.xUITest.executeCommand(".uno:Sidebar") + + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + xHeadings = xContentTree.getChild('0') + self.assertEqual('Headings', get_state_as_dict(xHeadings)['Text']) + + xHeadings.executeAction("EXPAND", tuple()) + + self.assertEqual(5, len(xHeadings.getChildren())) + + for i in range(5): + self.assertEqual('P' + str(i + 1), get_state_as_dict(xHeadings.getChild(str(i)))['Text']) + + self.xUITest.executeCommand(".uno:Sidebar") + + cursor = document.getCurrentController().getViewCursor() + + # Use Adding Selection + selectionProperty = mkPropertyValues({"SelectionMode": 2}) + self.xUITest.executeCommandWithParameters(".uno:SelectionMode", selectionProperty) + + # Go to P2 and select it + cursor.goUp(3, False) + cursor.gotoStartOfLine(False) + cursor.gotoEndOfLine(True) + + # Go to P4 and select it + cursor.goDown(2, False) + cursor.gotoStartOfLine(False) + cursor.gotoEndOfLine(True) + + self.change_outline_level("Level 2") + + self.xUITest.executeCommand(".uno:Sidebar") + + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + xHeadings = xContentTree.getChild('0') + self.assertEqual('Headings', get_state_as_dict(xHeadings)['Text']) + + xHeadings.executeAction("EXPAND", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: 3 != 4 + self.assertEqual(3, len(xHeadings.getChildren())) + xChild1 = xHeadings.getChild('0') + self.assertEqual('P1', get_state_as_dict(xChild1)['Text']) + xChild1.executeAction("EXPAND", tuple()) + self.assertEqual(1, len(xChild1.getChildren())) + self.assertEqual('P2', get_state_as_dict(xChild1.getChild('0'))['Text']) + + xChild2 = xHeadings.getChild('1') + self.assertEqual('P3', get_state_as_dict(xChild2)['Text']) + xChild2.executeAction("EXPAND", tuple()) + self.assertEqual(1, len(xChild2.getChildren())) + self.assertEqual('P4', get_state_as_dict(xChild2.getChild('0'))['Text']) + + self.assertEqual('P5', get_state_as_dict(xHeadings.getChild('2'))['Text']) + + self.xUITest.executeCommand(".uno:Sidebar") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf140661.py b/sw/qa/uitest/navigator/tdf140661.py new file mode 100644 index 000000000..d6c79eb2a --- /dev/null +++ b/sw/qa/uitest/navigator/tdf140661.py @@ -0,0 +1,64 @@ +# -*- 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, get_url_for_data_file + +class tdf140661(UITestCase): + + def launch_navigator(self, bIsBeforeUngroup): + xMainWindow = self.xUITest.getTopFocusWindow() + xWriterEdit = xMainWindow.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + xDrawings = xContentTree.getChild('11') + self.assertEqual('Drawing objects', get_state_as_dict(xDrawings)['Text']) + + xDrawings.executeAction("EXPAND", tuple()) + + if bIsBeforeUngroup: + self.assertEqual(1, len(xDrawings.getChildren())) + self.assertEqual('DrawObject1', get_state_as_dict(xDrawings.getChild('0'))['Text']) + else: + self.assertEqual(12, len(xDrawings.getChildren())) + + # tdf#134960 + expectedShapeOrder = [1, 2, 8, 9, 7, 10, 11, 3, 12, 4, 5, 6] + for i in range(12): + self.assertEqual('Shape' + str(expectedShapeOrder[i]), get_state_as_dict(xDrawings.getChild(str(i)))['Text']) + + xDrawings.executeAction("COLLAPSE", tuple()) + + self.xUITest.executeCommand(".uno:Sidebar") + + def test_tdf140661(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf140661.odt")) as writer_doc: + + self.launch_navigator(True) + + # Select the shape and ungroup it + self.xUITest.executeCommand(".uno:JumpToNextFrame") + + self.ui_test.wait_until_child_is_available('metricfield') + + self.xUITest.executeCommand(".uno:FormatUngroup") + + # Without the fix in place, this test would have failed with + # AssertionError: 12 != 0 + self.launch_navigator(False) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf143569.py b/sw/qa/uitest/navigator/tdf143569.py new file mode 100644 index 000000000..95dbc2dc9 --- /dev/null +++ b/sw/qa/uitest/navigator/tdf143569.py @@ -0,0 +1,69 @@ +# -*- 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, get_url_for_data_file + +class tdf143569(UITestCase): + + def test_Tdf143569(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf143569.odt")) as writer_doc: + + xMainWindow = self.xUITest.getTopFocusWindow() + xWriterEdit = xMainWindow.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + + xHeadings = xContentTree.getChild('0') + self.assertEqual('Headings', get_state_as_dict(xHeadings)['Text']) + self.assertEqual("1", get_state_as_dict(xHeadings)['Children']) + + xHeadings.executeAction("EXPAND", tuple()) + + xChild = xHeadings.getChild('0') + + # Without the fix in place, this test would have failed with + # AssertionError: 'Introduction' != 'Anchored to Paragraph' + self.assertEqual('Introduction', get_state_as_dict(xChild)['Text']) + self.assertEqual("1", get_state_as_dict(xChild)['Children']) + + xChild.executeAction("EXPAND", tuple()) + + xChild = xChild.getChild('0') + self.assertEqual('Problem', get_state_as_dict(xChild)['Text']) + self.assertEqual("1", get_state_as_dict(xChild)['Children']) + + xChild.executeAction("EXPAND", tuple()) + + xChild = xChild.getChild('0') + self.assertEqual('Discussion Agenda', get_state_as_dict(xChild)['Text']) + self.assertEqual("2", get_state_as_dict(xChild)['Children']) + + xChild.executeAction("EXPAND", tuple()) + + xChild1 = xChild.getChild('0') + self.assertEqual('Anchored to Paragraph', get_state_as_dict(xChild1)['Text']) + self.assertEqual("0", get_state_as_dict(xChild1)['Children']) + + xChild2 = xChild.getChild('1') + self.assertEqual('Anchored as Character', get_state_as_dict(xChild2)['Text']) + self.assertEqual("0", get_state_as_dict(xChild2)['Children']) + + self.xUITest.executeCommand(".uno:Sidebar") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf144672.py b/sw/qa/uitest/navigator/tdf144672.py new file mode 100644 index 000000000..5d64d63b2 --- /dev/null +++ b/sw/qa/uitest/navigator/tdf144672.py @@ -0,0 +1,55 @@ +# -*- 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, get_url_for_data_file + +class tdf144672(UITestCase): + + def test_Tdf144672(self): + with self.ui_test.load_file(get_url_for_data_file("tdf144672.odt")) as writer_doc: + + xMainWindow = self.xUITest.getTopFocusWindow() + xWriterEdit = xMainWindow.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + + xReferences = xContentTree.getChild('8') + self.assertEqual('References', get_state_as_dict(xReferences)['Text']) + + # tdf#129625: Without the fix in place, this test would have failed with + # AssertionError: 'true' != 'false' + self.assertEqual('true', get_state_as_dict(xReferences)['IsSemiTransparent']) + + xIndexes = xContentTree.getChild('9') + self.assertEqual('Indexes', get_state_as_dict(xIndexes)['Text']) + self.assertEqual('false', get_state_as_dict(xIndexes)['IsSemiTransparent']) + + xIndexes.executeAction("EXPAND", tuple()) + + self.assertEqual('3', get_state_as_dict(xIndexes)['Children']) + + for i in range(3): + # Without the fix in place, this test would have failed here with + # AssertionError: 'false' != 'true' + self.assertEqual('false', get_state_as_dict(xIndexes.getChild(i))['IsSemiTransparent']) + + xIndexes.executeAction("COLLAPSE", tuple()) + + self.xUITest.executeCommand(".uno:Sidebar") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf148198.py b/sw/qa/uitest/navigator/tdf148198.py new file mode 100644 index 000000000..d273bb6b5 --- /dev/null +++ b/sw/qa/uitest/navigator/tdf148198.py @@ -0,0 +1,61 @@ +# -*- 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, get_url_for_data_file + +class tdf148198(UITestCase): + + def test_tdf148198(self): + sHyperlink0 = 'a hyperlink with an anchor, different character styles, a footnote1, a field This is a bookmark, and a rsid' + sHyperlink1 = 'another hyperlink' + + with self.ui_test.load_file(get_url_for_data_file('hyperlink_multiple_spans.fodt')): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild('writer_edit') + + self.xUITest.executeCommand('.uno:Sidebar') + xWriterEdit.executeAction('SIDEBAR', mkPropertyValues({'PANEL': 'SwNavigatorPanel'})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild('contenttree') + xHyperlinks = xContentTree.getChild('7') + self.assertEqual('Hyperlinks', get_state_as_dict(xHyperlinks)['Text']) + + xHyperlinks.executeAction('EXPAND', tuple()) + + self.assertEqual('2', get_state_as_dict(xHyperlinks)['Children']) + self.assertEqual(sHyperlink0, get_state_as_dict(xHyperlinks.getChild('0'))['Text']) + self.assertEqual(sHyperlink1, get_state_as_dict(xHyperlinks.getChild('1'))['Text']) + + # save and reload: the first hyperlink must be kept in one piece + self.xUITest.executeCommand('.uno:Save') + self.xUITest.executeCommand('.uno:Reload') + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild('contenttree') + xHyperlinks = xContentTree.getChild('7') + self.assertEqual('Hyperlinks', get_state_as_dict(xHyperlinks)['Text']) + + xHyperlinks.executeAction('EXPAND', tuple()) + + # without the fix in place, this would fail: + # AssertionError: '2' != '11' + self.assertEqual('2', get_state_as_dict(xHyperlinks)['Children']) + self.assertEqual(sHyperlink0, get_state_as_dict(xHyperlinks.getChild('0'))['Text']) + self.assertEqual(sHyperlink1, get_state_as_dict(xHyperlinks.getChild('1'))['Text']) + + self.xUITest.executeCommand('.uno:Sidebar') + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf149268.py b/sw/qa/uitest/navigator/tdf149268.py new file mode 100644 index 000000000..3a0943c76 --- /dev/null +++ b/sw/qa/uitest/navigator/tdf149268.py @@ -0,0 +1,43 @@ +# -*- 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, get_url_for_data_file + +class tdf149268(UITestCase): + + def test_tdf149268(self): + with self.ui_test.load_file(get_url_for_data_file("tdf149268.odt")): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:Sidebar") + + # Without the fix in place, this test would have crashed here + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + xHyperlinks = xContentTree.getChild('7') + self.assertEqual('Hyperlinks', get_state_as_dict(xHyperlinks)['Text']) + + xHyperlinks.executeAction("EXPAND", tuple()) + + self.assertEqual("4", get_state_as_dict(xHyperlinks)['Children']) + self.assertEqual('Internet', get_state_as_dict(xHyperlinks.getChild('0'))['Text']) + self.assertEqual('1234567', get_state_as_dict(xHyperlinks.getChild('1'))['Text']) + self.assertEqual('yyyy', get_state_as_dict(xHyperlinks.getChild('2'))['Text']) + self.assertEqual('zzz', get_state_as_dict(xHyperlinks.getChild('3'))['Text']) + + self.xUITest.executeCommand(".uno:Sidebar") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/navigator/tdf40427.py b/sw/qa/uitest/navigator/tdf40427.py new file mode 100644 index 000000000..3192dc71d --- /dev/null +++ b/sw/qa/uitest/navigator/tdf40427.py @@ -0,0 +1,77 @@ +# -*- 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, get_url_for_data_file + +class tdf40427(UITestCase): + + def test_tdf40427(self): + with self.ui_test.load_file(get_url_for_data_file("tdf40427_SectionPositions.odt")) as document: + xMainWindow = self.xUITest.getTopFocusWindow() + xWriterEdit = xMainWindow.getChild("writer_edit") + + self.assertEqual(2, document.CurrentController.PageCount) + + # Make sure that the view is 2 pages side-by-side - look at dialog View-Zoom-Zoom + with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog: + + columnssb = xDialog.getChild("columnssb") + columns = xDialog.getChild("columns") + bookmode = xDialog.getChild("bookmode") + self.assertEqual("true", get_state_as_dict(columns)["Checked"]) + self.assertEqual("2", get_state_as_dict(columnssb)["Text"]) + self.assertEqual("false", get_state_as_dict(bookmode)["Selected"]) + + + # In this view, the sections "SectionB" and "SectionC" on second page are positioned on screen + # higher than "SectionY" and "SectionA" respectively; there are nested and anchored sections. + # Make sure that order in Navigator follows their relative position in document, not vertical + # position on screen, nor sorted alphabetically. Sections in flying frames are sorted by their + # anchor position in the document. + + self.xUITest.executeCommand(".uno:Sidebar") + xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) + + # wait until the navigator panel is available + xNavigatorPanel = self.ui_test.wait_until_child_is_available('NavigatorPanel') + + xContentTree = xNavigatorPanel.getChild("contenttree") + xSections = xContentTree.getChild('6') + self.assertEqual('Sections', get_state_as_dict(xSections)['Text']) + xSections.executeAction("EXPAND", ()) + + refSectionNames = [ + 'SectionZ', + 'SectionY', # SectionB should not get before this, despite its Y position on screen is higher + 'SectionT3', # Sections in tables go in rows, then across rows + 'SectionT1', + 'SectionT2', + 'SectionT0', + 'SectionF2', # Goes before SectionF1, because their fly anchors go in that order + 'SectionF3', # Same as SectionF1, but anchor section is in fly itself + 'SectionFinF3', # Check order of nested sections inside fly + 'SectionA', + 'SectionF1', # Section in fly anchored in a section goes immediately after its anchor section + 'SectionB', # High on screen, but late in list because it's on second page + 'SectionC', + ] + self.assertEqual(len(refSectionNames), len(xSections.getChildren())) + + actSectionNames = [] + for i in range(len(refSectionNames)): + actSectionNames.append(get_state_as_dict(xSections.getChild(str(i)))['Text']) + # Without the fix in place, this would fail with + # AssertionError: Lists differ: ['SectionZ', 'SectionY', 'SectionT3', 'SectionT1', 'SectionT2'[100 chars]onC'] != ['SectionZ', 'SectionB', 'SectionF3', 'SectionFinF3', 'Section[100 chars]onA'] + self.assertEqual(refSectionNames, actSectionNames) + + self.xUITest.executeCommand(".uno:Sidebar") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |