summaryrefslogtreecommitdiff
path: root/sw/qa/uitest/navigator
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2023-05-26 21:29:47 -0800
committerJim Raykowski <raykowj@gmail.com>2023-06-03 20:47:39 +0200
commit4f69e1b07c12ebd8c3655f3205bff143d1ee1a1b (patch)
tree6c86588989c93961062e85d6997b4b2622aaf6d2 /sw/qa/uitest/navigator
parent666925f2ab06e690c41c470713dc83f2d752bfb7 (diff)
tdf#153721 SwNavigator: fix chapter move
Fixes move chapter up/down regressions introduced by commit e27b936fe864cdd2753470e0fef1e3cb1f891555. For regression details please see comments 14 and 16 in the bug report. Change-Id: I0a57483fae51656c89e8b4f3711d8057174517e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152347 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw/qa/uitest/navigator')
-rw-r--r--sw/qa/uitest/navigator/movechapterupdown.py507
1 files changed, 507 insertions, 0 deletions
diff --git a/sw/qa/uitest/navigator/movechapterupdown.py b/sw/qa/uitest/navigator/movechapterupdown.py
new file mode 100644
index 000000000000..ce73391200ea
--- /dev/null
+++ b/sw/qa/uitest/navigator/movechapterupdown.py
@@ -0,0 +1,507 @@
+# -*- 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
+import time
+
+class movechapterupdown(UITestCase):
+
+ def test_movechapterupdown(self):
+
+ with self.ui_test.load_file(get_url_for_data_file('MoveChapterUpDown.odt')):
+ 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')
+
+ # HACK, see the `m_aUpdTimer.SetTimeout(1000)` in the SwContentTree ctor in
+ # sw/source/uibase/utlui/content.cxx, where that m_aUpdTimer is started by
+ # SwContentTree::ShowTree triggered from the SIDEBAR action above, and which can
+ # invalidate the TreeListEntryUIObjects used by the below code (see
+ # 2798430c8a711861fdcdfbf9ac00a0527abd3bfc "Mark the uses of TreeListEntryUIObject as
+ # dubious"); lets double that 1000 ms timeout value here to hopefully be on the safe
+ # side:
+ time.sleep(2)
+
+ # Given the document chapter structure:
+ # 1. One H1
+ # 1.1. one_A (H2)
+ # 1.2. one_B (H2)
+ # 2. Two (H1)
+ # A heading of level 3
+ # 2.1. Two_A (H2)
+ # 2.1. Two_B (H2)
+ # 3. Three (H1)
+ # 3.1. Three_A (H2)
+ # 3.2. Three_B (H2)
+
+ xNavigatorPanelContentTree = xNavigatorPanel.getChild("contenttree")
+
+ xNavigatorPanelContentTreeHeadings = xNavigatorPanelContentTree.getChild('0')
+ xNavigatorPanelContentTreeHeadings.executeAction("EXPAND", tuple())
+
+ #
+ # test a level 1 chapter move up then move down
+ #
+
+ # Double click on the "2. Two (H1)" entry to select and set focus
+ xHeadingsChild1 = xNavigatorPanelContentTreeHeadings.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1)["Text"], "2. Two (H1)")
+ xHeadingsChild1.executeAction("DOUBLECLICK", tuple())
+
+ self.ui_test.wait_until_property_is_updated(xNavigatorPanelContentTree, "SelectEntryText", "2. Two (H1)")
+
+ # Click on the 'Move chapter up' button in the Navigator tool box
+ xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel")
+ xToolBarContent6 = xNavigatorPanel.getChild("content6")
+ xToolBarContent6.executeAction("CLICK", mkPropertyValues({"POS": "4"}))
+
+ # Expected chapter order:
+ # 2. Two (H1)
+ # A heading of level 3
+ # 2.1. Two_A (H2)
+ # 2.1. Two_B (H2)
+ # 1. One (H1)
+ # 1.1. One_A (H2)
+ # 1.2. One_B (H2)
+ # 3. Three (H1)
+ # 3.1. Three_A (H2)
+ # 3.2. Three_B (H2)
+
+ xNavigatorPanelContentTreeHeadings = xNavigatorPanelContentTree.getChild('0')
+
+ xHeadingsChild0 = xNavigatorPanelContentTreeHeadings.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0)["Text"], "2. Two (H1)")
+ xHeadingsChild0Child0 = xHeadingsChild0.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child0)["Text"], "A heading of level 3")
+ xHeadingsChild0Child1 = xHeadingsChild0.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child1)["Text"], "2.1. Two_A (H2)")
+ xHeadingsChild0Child2 = xHeadingsChild0.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child2)["Text"], "2.1. Two_B (H2)")
+
+ xHeadingsChild1 = xNavigatorPanelContentTreeHeadings.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1)["Text"], "1. One (H1)")
+ xHeadingsChild1Child0 = xHeadingsChild1.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child0)["Text"], "1.1. One_A (H2)")
+ xHeadingsChild1Child1 = xHeadingsChild1.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child1)["Text"], "1.2. One_B (H2)")
+
+ xHeadingsChild2 = xNavigatorPanelContentTreeHeadings.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2)["Text"], "3. Three (H1)")
+ xHeadingsChild2Child0 = xHeadingsChild2.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child0)["Text"], "3.1. Three_A (H2)")
+ xHeadingsChild2Child1 = xHeadingsChild2.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child1)["Text"], "3.2. Three_B (H2)")
+
+ # Click on the 'Move chapter down' button in the Navigator tool box
+ xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel")
+ xToolBarContent6 = xNavigatorPanel.getChild("content6")
+ xToolBarContent6.executeAction("CLICK", mkPropertyValues({"POS": "5"}))
+
+ # Expected chapter order is the original order
+ xNavigatorPanelContentTreeHeadings = xNavigatorPanelContentTree.getChild('0')
+
+ xHeadingsChild0 = xNavigatorPanelContentTreeHeadings.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0)["Text"], "1. One (H1)")
+ xHeadingsChild0Child0 = xHeadingsChild0.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child0)["Text"], "1.1. One_A (H2)")
+ xHeadingsChild0Child1 = xHeadingsChild0.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child1)["Text"], "1.2. One_B (H2)")
+
+ xHeadingsChild1 = xNavigatorPanelContentTreeHeadings.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1)["Text"], "2. Two (H1)")
+ xHeadingsChild1Child0 = xHeadingsChild1.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child0)["Text"], "A heading of level 3")
+ xHeadingsChild1Child1 = xHeadingsChild1.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child1)["Text"], "2.1. Two_A (H2)")
+ xHeadingsChild1Child2 = xHeadingsChild1.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child2)["Text"], "2.1. Two_B (H2)")
+
+ xHeadingsChild2 = xNavigatorPanelContentTreeHeadings.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2)["Text"], "3. Three (H1)")
+ xHeadingsChild2Child0 = xHeadingsChild2.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child0)["Text"], "3.1. Three_A (H2)")
+ xHeadingsChild2Child1 = xHeadingsChild2.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child1)["Text"], "3.2. Three_B (H2)")
+
+ #
+ # test a level 1 chapter move down then move up
+ #
+
+ # Double click on the "2. Two (H1)" entry to select and set focus
+ xHeadingsChild1 = xNavigatorPanelContentTreeHeadings.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1)["Text"], "2. Two (H1)")
+ xHeadingsChild1.executeAction("DOUBLECLICK", tuple())
+
+ self.ui_test.wait_until_property_is_updated(xNavigatorPanelContentTree, "SelectEntryText", "2. Two (H1)")
+
+ # Click on the 'Move chapter down' button in the Navigator tool box
+ xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel")
+ xToolBarContent6 = xNavigatorPanel.getChild("content6")
+ xToolBarContent6.executeAction("CLICK", mkPropertyValues({"POS": "5"}))
+
+ # Expected chapter order:
+ # 1. One (H1)
+ # 1.1. One_A (H2)
+ # 1.2. One_B (H2)
+ # 3. Three (H1)
+ # 3.1. Three_A (H2)
+ # 3.2. Three_B (H2)
+ # 2. Two (H1)
+ # A heading of level 3
+ # 2.1. Two_A (H2)
+ # 2.1. Two_B (H2)
+
+ xNavigatorPanelContentTreeHeadings = xNavigatorPanelContentTree.getChild('0')
+
+ xHeadingsChild0 = xNavigatorPanelContentTreeHeadings.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0)["Text"], "1. One (H1)")
+ xHeadingsChild0Child0 = xHeadingsChild0.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child0)["Text"], "1.1. One_A (H2)")
+ xHeadingsChild0Child1 = xHeadingsChild0.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child1)["Text"], "1.2. One_B (H2)")
+
+ xHeadingsChild1 = xNavigatorPanelContentTreeHeadings.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1)["Text"], "3. Three (H1)")
+ xHeadingsChild1Child0 = xHeadingsChild1.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child0)["Text"], "3.1. Three_A (H2)")
+ xHeadingsChild1Child1 = xHeadingsChild1.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child1)["Text"], "3.2. Three_B (H2)")
+
+ xHeadingsChild2 = xNavigatorPanelContentTreeHeadings.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2)["Text"], "2. Two (H1)")
+ xHeadingsChild2Child0 = xHeadingsChild2.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child0)["Text"], "A heading of level 3")
+ xHeadingsChild2Child1 = xHeadingsChild2.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child1)["Text"], "2.1. Two_A (H2)")
+ xHeadingsChild2Child2 = xHeadingsChild2.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child2)["Text"], "2.1. Two_B (H2)")
+
+ # Click on the 'Move chapter up' button in the Navigator tool box
+ xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel")
+ xToolBarContent6 = xNavigatorPanel.getChild("content6")
+ xToolBarContent6.executeAction("CLICK", mkPropertyValues({"POS": "4"}))
+
+ # Expected chapter order is the original order
+ xNavigatorPanelContentTreeHeadings = xNavigatorPanelContentTree.getChild('0')
+
+ xHeadingsChild0 = xNavigatorPanelContentTreeHeadings.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0)["Text"], "1. One (H1)")
+ xHeadingsChild0Child0 = xHeadingsChild0.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child0)["Text"], "1.1. One_A (H2)")
+ xHeadingsChild0Child1 = xHeadingsChild0.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child1)["Text"], "1.2. One_B (H2)")
+
+ xHeadingsChild1 = xNavigatorPanelContentTreeHeadings.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1)["Text"], "2. Two (H1)")
+ xHeadingsChild1Child0 = xHeadingsChild1.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child0)["Text"], "A heading of level 3")
+ xHeadingsChild1Child1 = xHeadingsChild1.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child1)["Text"], "2.1. Two_A (H2)")
+ xHeadingsChild1Child2 = xHeadingsChild1.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child2)["Text"], "2.1. Two_B (H2)")
+
+ xHeadingsChild2 = xNavigatorPanelContentTreeHeadings.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2)["Text"], "3. Three (H1)")
+ xHeadingsChild2Child0 = xHeadingsChild2.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child0)["Text"], "3.1. Three_A (H2)")
+ xHeadingsChild2Child1 = xHeadingsChild2.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child1)["Text"], "3.2. Three_B (H2)")
+
+ #
+ # test a sub chapter move chapter up then move down
+ #
+
+ # Double click on the "2.1. Two_A (H2)" entry to select and set focus
+ xHeadingsChild1 = xNavigatorPanelContentTreeHeadings.getChild('1')
+ xHeadingsChild1Child1 = xHeadingsChild1.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child1)["Text"], "2.1. Two_A (H2)")
+ xHeadingsChild1Child1.executeAction("DOUBLECLICK", tuple())
+
+ self.ui_test.wait_until_property_is_updated(xNavigatorPanelContentTree, "SelectEntryText", "2.1. Two_A (H2)")
+
+ # Click on the 'Move chapter up' button in the Navigator tool box
+ xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel")
+ xToolBarContent6 = xNavigatorPanel.getChild("content6")
+ xToolBarContent6.executeAction("CLICK", mkPropertyValues({"POS": "4"}))
+
+ # Expected chapter order:
+ # 1. One H1
+ # 1.1. one_A (H2)
+ # 1.2. one_B (H2)
+ # 2. Two (H1)
+ # 2.1. Two_A (H2)
+ # A heading of level 3
+ # 2.1. Two_B (H2)
+ # 3. Three (H1)
+ # 3.1. Three_A (H2)
+ # 3.2. Three_B (H2)
+
+ xNavigatorPanelContentTreeHeadings = xNavigatorPanelContentTree.getChild('0')
+
+ xHeadingsChild0 = xNavigatorPanelContentTreeHeadings.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0)["Text"], "1. One (H1)")
+ xHeadingsChild0Child0 = xHeadingsChild0.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child0)["Text"], "1.1. One_A (H2)")
+ xHeadingsChild0Child1 = xHeadingsChild0.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child1)["Text"], "1.2. One_B (H2)")
+
+ xHeadingsChild1 = xNavigatorPanelContentTreeHeadings.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1)["Text"], "2. Two (H1)")
+ xHeadingsChild1Child0 = xHeadingsChild1.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child0)["Text"], "2.1. Two_A (H2)")
+ xHeadingsChild1Child0Child0 = xHeadingsChild1Child0.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child0Child0)["Text"], "A heading of level 3")
+ xHeadingsChild1Child1 = xHeadingsChild1.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child1)["Text"], "2.1. Two_B (H2)")
+
+ xHeadingsChild2 = xNavigatorPanelContentTreeHeadings.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2)["Text"], "3. Three (H1)")
+ xHeadingsChild2Child0 = xHeadingsChild2.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child0)["Text"], "3.1. Three_A (H2)")
+ xHeadingsChild2Child1 = xHeadingsChild2.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child1)["Text"], "3.2. Three_B (H2)")
+
+ self.ui_test.wait_until_property_is_updated(xNavigatorPanelContentTree, "SelectEntryText", "2.1. Two_A (H2)")
+
+ # Click on the 'Move chapter down' button in the Navigator tool box
+ xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel")
+ xToolBarContent6 = xNavigatorPanel.getChild("content6")
+ xToolBarContent6.executeAction("CLICK", mkPropertyValues({"POS": "5"}))
+
+ # Expected chapter order:
+ # 1. One H1
+ # 1.1. one_A (H2)
+ # 1.2. one_B (H2)
+ # 2. Two (H1)
+ # 2.1. Two_B (H2)
+ # 2.1. Two_A (H2)
+ # A heading of level 3
+ # 3. Three (H1)
+ # 3.1. Three_A (H2)
+ # 3.2. Three_B (H2)
+
+ xNavigatorPanelContentTreeHeadings = xNavigatorPanelContentTree.getChild('0')
+
+ xHeadingsChild0 = xNavigatorPanelContentTreeHeadings.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0)["Text"], "1. One (H1)")
+ xHeadingsChild0Child0 = xHeadingsChild0.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child0)["Text"], "1.1. One_A (H2)")
+ xHeadingsChild0Child1 = xHeadingsChild0.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child1)["Text"], "1.2. One_B (H2)")
+
+ xHeadingsChild1 = xNavigatorPanelContentTreeHeadings.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1)["Text"], "2. Two (H1)")
+ xHeadingsChild1Child0 = xHeadingsChild1.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child0)["Text"], "2.1. Two_B (H2)")
+ xHeadingsChild1Child1 = xHeadingsChild1.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child1)["Text"], "2.1. Two_A (H2)")
+ xHeadingsChild1Child1Child0 = xHeadingsChild1Child1.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child1Child0)["Text"], "A heading of level 3")
+
+ xHeadingsChild2 = xNavigatorPanelContentTreeHeadings.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2)["Text"], "3. Three (H1)")
+ xHeadingsChild2Child0 = xHeadingsChild2.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child0)["Text"], "3.1. Three_A (H2)")
+ xHeadingsChild2Child1 = xHeadingsChild2.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child1)["Text"], "3.2. Three_B (H2)")
+
+ # Move "A heading of level 3" to its orignal position
+
+ # Double click on the "A heading of level 3" entry to select and set focus
+ xHeadingsChild1 = xNavigatorPanelContentTreeHeadings.getChild('1')
+ xHeadingsChild1Child1Child0 = xHeadingsChild1Child1.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child1Child0)["Text"], "A heading of level 3")
+ xHeadingsChild1Child1Child0.executeAction("DOUBLECLICK", tuple())
+
+ self.ui_test.wait_until_property_is_updated(xNavigatorPanelContentTree, "SelectEntryText", "A heading of level 3")
+
+ # Click on the 'Move chapter up' button in the Navigator tool box
+ xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel")
+ xToolBarContent6 = xNavigatorPanel.getChild("content6")
+ xToolBarContent6.executeAction("CLICK", mkPropertyValues({"POS": "4"}))
+
+ # Click on the 'Move chapter up' button in the Navigator tool box
+ xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel")
+ xToolBarContent6 = xNavigatorPanel.getChild("content6")
+ xToolBarContent6.executeAction("CLICK", mkPropertyValues({"POS": "4"}))
+
+ # Expected chapter order:
+ # 1. One H1
+ # 1.1. one_A (H2)
+ # 1.2. one_B (H2)
+ # 2. Two (H1)
+ # A heading of level 3
+ # 2.1. Two_B (H2)
+ # 2.1. Two_A (H2)
+ # 3. Three (H1)
+ # 3.1. Three_A (H2)
+ # 3.2. Three_B (H2)
+
+ xNavigatorPanelContentTreeHeadings = xNavigatorPanelContentTree.getChild('0')
+
+ xHeadingsChild0 = xNavigatorPanelContentTreeHeadings.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0)["Text"], "1. One (H1)")
+ xHeadingsChild0Child0 = xHeadingsChild0.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child0)["Text"], "1.1. One_A (H2)")
+ xHeadingsChild0Child1 = xHeadingsChild0.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child1)["Text"], "1.2. One_B (H2)")
+
+ xHeadingsChild1 = xNavigatorPanelContentTreeHeadings.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1)["Text"], "2. Two (H1)")
+ xHeadingsChild1Child0 = xHeadingsChild1.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child0)["Text"], "A heading of level 3")
+ xHeadingsChild1Child1 = xHeadingsChild1.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child1)["Text"], "2.1. Two_B (H2)")
+ xHeadingsChild1Child2 = xHeadingsChild1.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child2)["Text"], "2.1. Two_A (H2)")
+
+ xHeadingsChild2 = xNavigatorPanelContentTreeHeadings.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2)["Text"], "3. Three (H1)")
+ xHeadingsChild2Child0 = xHeadingsChild2.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child0)["Text"], "3.1. Three_A (H2)")
+ xHeadingsChild2Child1 = xHeadingsChild2.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child1)["Text"], "3.2. Three_B (H2)")
+
+ # Move "2.1. Two_B (H2)" to its orignal position
+
+ # Double click on the "2.1. Two_B (H2)" entry to select and set focus
+ xHeadingsChild1 = xNavigatorPanelContentTreeHeadings.getChild('1')
+ xHeadingsChild1Child1 = xHeadingsChild1.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child1)["Text"], "2.1. Two_B (H2)")
+ xHeadingsChild1Child1.executeAction("DOUBLECLICK", tuple())
+
+ self.ui_test.wait_until_property_is_updated(xNavigatorPanelContentTree, "SelectEntryText", "2.1. Two_B (H2)")
+
+ # Click on the 'Move chapter down' button in the Navigator tool box
+ xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel")
+ xToolBarContent6 = xNavigatorPanel.getChild("content6")
+ xToolBarContent6.executeAction("CLICK", mkPropertyValues({"POS": "5"}))
+
+ # Expected chapter order is the original order
+ xNavigatorPanelContentTreeHeadings = xNavigatorPanelContentTree.getChild('0')
+
+ xHeadingsChild0 = xNavigatorPanelContentTreeHeadings.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0)["Text"], "1. One (H1)")
+ xHeadingsChild0Child0 = xHeadingsChild0.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child0)["Text"], "1.1. One_A (H2)")
+ xHeadingsChild0Child1 = xHeadingsChild0.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child1)["Text"], "1.2. One_B (H2)")
+
+ xHeadingsChild1 = xNavigatorPanelContentTreeHeadings.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1)["Text"], "2. Two (H1)")
+ xHeadingsChild1Child0 = xHeadingsChild1.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child0)["Text"], "A heading of level 3")
+ xHeadingsChild1Child1 = xHeadingsChild1.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child1)["Text"], "2.1. Two_A (H2)")
+ xHeadingsChild1Child2 = xHeadingsChild1.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child2)["Text"], "2.1. Two_B (H2)")
+
+ xHeadingsChild2 = xNavigatorPanelContentTreeHeadings.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2)["Text"], "3. Three (H1)")
+ xHeadingsChild2Child0 = xHeadingsChild2.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child0)["Text"], "3.1. Three_A (H2)")
+ xHeadingsChild2Child1 = xHeadingsChild2.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child1)["Text"], "3.2. Three_B (H2)")
+
+ #
+ # test moving a sub chapter out of and then back into its parent
+ #
+
+ # Double click on the "1.1. One_A (H2)" entry to select and set focus
+ xHeadingsChild0 = xNavigatorPanelContentTreeHeadings.getChild('0')
+ xHeadingsChild0Child0 = xHeadingsChild0.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child0)["Text"], "1.1. One_A (H2)")
+ xHeadingsChild0Child0.executeAction("DOUBLECLICK", tuple())
+
+ self.ui_test.wait_until_property_is_updated(xNavigatorPanelContentTree, "SelectEntryText", "1.1. One_A (H2)")
+
+ # Click on the 'Move chapter up' button in the Navigator tool box
+ xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel")
+ xToolBarContent6 = xNavigatorPanel.getChild("content6")
+ xToolBarContent6.executeAction("CLICK", mkPropertyValues({"POS": "4"}))
+
+ # Expected chapter order:
+ # 1.1. One_A (H2)
+ # 1. One H1
+ # 1.2. One_B (H2)
+ # 2. Two (H1)
+ # A heading of level 3
+ # 2.1. Two_A (H2)
+ # 2.1. Two_B (H2)
+ # 3. Three (H1)
+ # 3.1. Three_A (H2)
+ # 3.2. Three_B (H2)
+
+ xNavigatorPanelContentTreeHeadings = xNavigatorPanelContentTree.getChild('0')
+
+ xHeadingsChild0 = xNavigatorPanelContentTreeHeadings.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0)["Text"], "1.1. One_A (H2)")
+
+ xHeadingsChild1 = xNavigatorPanelContentTreeHeadings.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1)["Text"], "1. One (H1)")
+ xHeadingsChild1Child0 = xHeadingsChild1.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child0)["Text"], "1.2. One_B (H2)")
+
+ xHeadingsChild2 = xNavigatorPanelContentTreeHeadings.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2)["Text"], "2. Two (H1)")
+ xHeadingsChild2Child0 = xHeadingsChild2.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child0)["Text"], "A heading of level 3")
+ xHeadingsChild2Child1 = xHeadingsChild2.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child1)["Text"], "2.1. Two_A (H2)")
+ xHeadingsChild2Child2 = xHeadingsChild2.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child2)["Text"], "2.1. Two_B (H2)")
+
+ xHeadingsChild3 = xNavigatorPanelContentTreeHeadings.getChild('3')
+ self.assertEqual(get_state_as_dict(xHeadingsChild3)["Text"], "3. Three (H1)")
+ xHeadingsChild3Child0 = xHeadingsChild3.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild3Child0)["Text"], "3.1. Three_A (H2)")
+ xHeadingsChild3Child1 = xHeadingsChild3.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild3Child1)["Text"], "3.2. Three_B (H2)")
+
+ # Click on the 'Move chapter down' button in the Navigator tool box
+ xNavigatorPanel = xWriterEdit.getChild("NavigatorPanel")
+ xToolBarContent6 = xNavigatorPanel.getChild("content6")
+ xToolBarContent6.executeAction("CLICK", mkPropertyValues({"POS": "5"}))
+
+ # Expected chapter order is the original order
+ xNavigatorPanelContentTreeHeadings = xNavigatorPanelContentTree.getChild('0')
+
+ xHeadingsChild0 = xNavigatorPanelContentTreeHeadings.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0)["Text"], "1. One (H1)")
+ xHeadingsChild0Child0 = xHeadingsChild0.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child0)["Text"], "1.1. One_A (H2)")
+ xHeadingsChild0Child1 = xHeadingsChild0.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild0Child1)["Text"], "1.2. One_B (H2)")
+
+ xHeadingsChild1 = xNavigatorPanelContentTreeHeadings.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1)["Text"], "2. Two (H1)")
+ xHeadingsChild1Child0 = xHeadingsChild1.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child0)["Text"], "A heading of level 3")
+ xHeadingsChild1Child1 = xHeadingsChild1.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child1)["Text"], "2.1. Two_A (H2)")
+ xHeadingsChild1Child2 = xHeadingsChild1.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild1Child2)["Text"], "2.1. Two_B (H2)")
+
+ xHeadingsChild2 = xNavigatorPanelContentTreeHeadings.getChild('2')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2)["Text"], "3. Three (H1)")
+ xHeadingsChild2Child0 = xHeadingsChild2.getChild('0')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child0)["Text"], "3.1. Three_A (H2)")
+ xHeadingsChild2Child1 = xHeadingsChild2.getChild('1')
+ self.assertEqual(get_state_as_dict(xHeadingsChild2Child1)["Text"], "3.2. Three_B (H2)")
+
+ self.xUITest.executeCommand('.uno:Sidebar')
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: