summaryrefslogtreecommitdiffstats
path: root/sw/qa/uitest/sidebar
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
commit267c6f2ac71f92999e969232431ba04678e7437e (patch)
tree358c9467650e1d0a1d7227a21dac2e3d08b622b2 /sw/qa/uitest/sidebar
parentInitial commit. (diff)
downloadlibreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz
libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/qa/uitest/sidebar')
-rw-r--r--sw/qa/uitest/sidebar/stylesSidebar.py76
-rw-r--r--sw/qa/uitest/sidebar/tdf133189.py71
-rw-r--r--sw/qa/uitest/sidebar/tdf135590.py73
-rw-r--r--sw/qa/uitest/sidebar/tdf152921.py70
-rw-r--r--sw/qa/uitest/sidebar/tdf99711.py38
5 files changed, 328 insertions, 0 deletions
diff --git a/sw/qa/uitest/sidebar/stylesSidebar.py b/sw/qa/uitest/sidebar/stylesSidebar.py
new file mode 100644
index 0000000000..ee20ef23d5
--- /dev/null
+++ b/sw/qa/uitest/sidebar/stylesSidebar.py
@@ -0,0 +1,76 @@
+# -*- 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 uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from uitest.uihelper.common import select_by_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class StylesSidebar(UITestCase):
+
+ def test_load_styles_from_template(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with self.ui_test.execute_dialog_through_command(".uno:LoadStyles", close_button="") as xDialog:
+ xText = xDialog.getChild("text")
+ xNumbering = xDialog.getChild("numbering")
+ xFrame = xDialog.getChild("frame")
+ xPages = xDialog.getChild("pages")
+
+ self.assertEqual('true', get_state_as_dict(xText)['Selected'])
+ self.assertEqual('false', get_state_as_dict(xNumbering)['Selected'])
+ self.assertEqual('false', get_state_as_dict(xFrame)['Selected'])
+ self.assertEqual('false', get_state_as_dict(xPages)['Selected'])
+
+ xNumbering.executeAction("CLICK", tuple())
+ xFrame.executeAction("CLICK", tuple())
+ xPages.executeAction("CLICK", tuple())
+
+ self.assertEqual('true', get_state_as_dict(xText)['Selected'])
+ self.assertEqual('true', get_state_as_dict(xNumbering)['Selected'])
+ self.assertEqual('true', get_state_as_dict(xFrame)['Selected'])
+ self.assertEqual('true', get_state_as_dict(xPages)['Selected'])
+
+ xFileName = xDialog.getChild("fromfile")
+
+ with self.ui_test.execute_dialog_through_action(xFileName, 'CLICK', close_button="open") as dialog:
+ xFileName = dialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("customStyles.odt")}))
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ expectedResults = ["customParagraphStyle", "customCharacterStyle", "customFrameStyle",
+ "customPageStyle", "customNumberingStyle"]
+
+ for i in range(5):
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "StyleListPanel"}))
+
+ xFilter = xWriterEdit.getChild('filter')
+ select_by_text(xFilter, "Custom Styles")
+
+ xLeft = xWriterEdit.getChild('left')
+
+ #change to another style type
+ xLeft.executeAction("CLICK", mkPropertyValues({"POS": str( i )}))
+
+ xFlatView = xWriterEdit.getChild("flatview")
+
+ self.assertEqual(1, len(xFlatView.getChildren()))
+
+ xFlatView.getChild('0').executeAction("SELECT", tuple())
+ self.ui_test.wait_until_property_is_updated(xFlatView, "SelectEntryText", expectedResults[i])
+ self.assertEqual(expectedResults[i], get_state_as_dict(xFlatView)['SelectEntryText'])
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/sidebar/tdf133189.py b/sw/qa/uitest/sidebar/tdf133189.py
new file mode 100644
index 0000000000..bc050cb7e1
--- /dev/null
+++ b/sw/qa/uitest/sidebar/tdf133189.py
@@ -0,0 +1,71 @@
+# -*- 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 uitest.uihelper.common import get_state_as_dict, select_pos
+from uitest.uihelper.common import change_measurement_unit
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf133189(UITestCase):
+ def test_tdf133189(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PageStylesPanel"}))
+
+ xPaperSize = xWriterEdit.getChild('papersize')
+ xPaperWidth = xWriterEdit.getChild('paperwidth')
+ xPaperHeight = xWriterEdit.getChild('paperheight')
+ xPaperOrient = xWriterEdit.getChild('paperorientation')
+ xPaperMargin = xWriterEdit.getChild('marginLB')
+
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ xWidth = xDialog.getChild('spinWidth')
+ xHeight = xDialog.getChild('spinHeight')
+
+ props = {"VALUE": '8.0'}
+ actionProps = mkPropertyValues(props)
+
+ xWidth.executeAction("VALUE", actionProps)
+ xHeight.executeAction("VALUE", actionProps)
+
+
+ self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (0.75″)")
+ self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (0.75″)")
+ self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User")
+ self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User")
+ self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait")
+ self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait")
+ self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "8.00″")
+ self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "8.00″")
+ self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "8.00″")
+ self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "8.00″")
+
+ with change_measurement_unit(self, 'Centimeter'):
+
+ self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (1.90 cm)")
+ # tdf#129267
+ self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (1.90 cm)")
+ self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User")
+ self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User")
+ self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait")
+ self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait")
+ self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "20.32 cm")
+ self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "20.32 cm")
+ self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "20.32 cm")
+ self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "20.32 cm")
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/sidebar/tdf135590.py b/sw/qa/uitest/sidebar/tdf135590.py
new file mode 100644
index 0000000000..20bd7a9fb1
--- /dev/null
+++ b/sw/qa/uitest/sidebar/tdf135590.py
@@ -0,0 +1,73 @@
+# -*- 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 uitest.uihelper.common import get_state_as_dict, select_pos
+from uitest.uihelper.common import change_measurement_unit
+from uitest.uihelper.common import select_by_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf135590(UITestCase):
+ def test_tdf135590(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with change_measurement_unit(self, 'Centimeter'):
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope") as xDialog:
+
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ xWidth = xDialog.getChild('width')
+ xHeight = xDialog.getChild('height')
+ xFormat = xDialog.getChild("format")
+
+ select_by_text(xFormat, "C6 Envelope")
+
+ self.assertEqual("16.2", get_state_as_dict(xWidth)['Value'])
+ self.assertEqual("11.4", get_state_as_dict(xHeight)['Value'])
+
+
+ # A new document is created
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ xWidth = xDialog.getChild('spinWidth')
+ xHeight = xDialog.getChild('spinHeight')
+ xFormatList = xDialog.getChild("comboPageFormat")
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '16.2' != '11.4'
+ self.assertEqual("16.2", get_state_as_dict(xWidth)['Value'])
+ self.assertEqual("11.4", get_state_as_dict(xHeight)['Value'])
+ self.assertEqual("User", get_state_as_dict(xFormatList)['SelectEntryText'])
+
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PageStylesPanel"}))
+
+ xPaperSize = xWriterEdit.getChild('papersize')
+ self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User")
+ self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User")
+
+ xPaperHeight = xWriterEdit.getChild('paperheight')
+ self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "11.40 cm")
+ self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "11.40 cm")
+
+ xPaperWidth = xWriterEdit.getChild('paperwidth')
+ self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "16.20 cm")
+ self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "16.20 cm")
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/sidebar/tdf152921.py b/sw/qa/uitest/sidebar/tdf152921.py
new file mode 100644
index 0000000000..77f0370e2d
--- /dev/null
+++ b/sw/qa/uitest/sidebar/tdf152921.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 tdf152921(UITestCase):
+
+ def test_tdf152921(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterEdit = self.xUITest.getTopFocusWindow().getChild("writer_edit")
+
+ # open the sidebar if need, it should already be open on a clean run
+ if 'TabBar' not in xWriterEdit.Children:
+ self.xUITest.executeCommand(".uno:Sidebar")
+
+ xTabBar = xWriterEdit.getChild('TabBar')
+
+ # make sure only the tabbar is visible, no deck
+ xDeckTitleToolBar = xWriterEdit.getChild('toolbar')
+ xDeckTitleToolBar.executeAction("CLICK", mkPropertyValues({"POS": "1"}))
+ # tabbar is visible, deck is not
+ # without the patch this assert would fail, a tab would be highlighted
+ self.assertFalse(len(get_state_as_dict(xTabBar)['HighlightedTabsIds']))
+
+ # open a panel and assert that a tab is highlighted, also assert that only one tab is
+ # highlighted, only a single tab should ever be highlighted
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "TextPropertyPanel"}))
+ self.assertTrue(len(get_state_as_dict(xTabBar)['HighlightedTabsIds']))
+ self.assertEqual(len(get_state_as_dict(xTabBar)['HighlightedTabsIds'].split(",")), 1)
+
+ # click on the 'Close Sidebar Deck' button in the deck title tool bar
+ xDeckTitleToolBar.executeAction("CLICK", mkPropertyValues({"POS": "1"}))
+ # without the patch this assert would fail, a tab would be highlighted
+ self.assertFalse(len(get_state_as_dict(xTabBar)['HighlightedTabsIds']))
+
+ # open a deck by simulating a click on a tab in the tabbar
+ xTabBar.executeAction("CLICK", mkPropertyValues({"POS": "4"}))
+ self.assertTrue(len(get_state_as_dict(xTabBar)['HighlightedTabsIds']))
+ self.assertEqual(len(get_state_as_dict(xTabBar)['HighlightedTabsIds'].split(",")), 1)
+
+ # close it by clicking on the same tab
+ xTabBar.executeAction("CLICK", mkPropertyValues({"POS": "4"}))
+ # tabbar is visible, deck is not
+ # without the patch this assert would fail, a tab would be highlighted
+ self.assertFalse(len(get_state_as_dict(xTabBar)['HighlightedTabsIds']))
+
+ # open a deck
+ xTabBar.executeAction("CLICK", mkPropertyValues({"POS": "3"}))
+ self.assertTrue(len(get_state_as_dict(xTabBar)['HighlightedTabsIds']))
+ self.assertEqual(len(get_state_as_dict(xTabBar)['HighlightedTabsIds'].split(",")), 1)
+
+ # open a different deck
+ xTabBar.executeAction("CLICK", mkPropertyValues({"POS": "1"}))
+ self.assertTrue(len(get_state_as_dict(xTabBar)['HighlightedTabsIds']))
+ self.assertEqual(len(get_state_as_dict(xTabBar)['HighlightedTabsIds'].split(",")), 1)
+
+ # click on the 'Close Sidebar Deck' button
+ xDeckTitleToolBar.executeAction("CLICK", mkPropertyValues({"POS": "1"}))
+ # without the patch this assert would fail, a tab would be highlighted
+ self.assertFalse(len(get_state_as_dict(xTabBar)['HighlightedTabsIds']))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/sidebar/tdf99711.py b/sw/qa/uitest/sidebar/tdf99711.py
new file mode 100644
index 0000000000..145b0373be
--- /dev/null
+++ b/sw/qa/uitest/sidebar/tdf99711.py
@@ -0,0 +1,38 @@
+# -*- 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 uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import change_measurement_unit
+
+class tdf99711(UITestCase):
+ def test_tdf99711(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("shape.odt")):
+
+ with change_measurement_unit(self, "Millimeter"):
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "TextPropertyPanel"}))
+
+ #wait until the sidebar is available
+ xChild = self.ui_test.wait_until_child_is_available('selectwidth')
+ self.assertEqual(get_state_as_dict(xChild)['Text'], '10.00 mm')
+
+ xChild = self.ui_test.wait_until_child_is_available('selectheight')
+ self.assertEqual(get_state_as_dict(xChild)['Text'], '10.00 mm')
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: