summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-09-08 09:53:59 +0200
committerMiklos Vajna <vmiklos@collabora.com>2022-10-20 10:54:24 +0200
commitff7b81697250b12044556dedd45ac1be3dc8037d (patch)
tree877792599ba2b08a2d13f57bc9ed847dc7c0fe3c
parenta1a67da15bdc6e932ef65cb188c9264d732e51eb (diff)
sw: add an initial uitest for SwContentControlDlg
And also test the inner SwContentControlListItemDlg. (cherry picked from commit b06bd8a4f837ea30d6410190c701f5b27ad9d04c) Conflicts: sw/Module_sw.mk Change-Id: Ida92223f49871900f8f6692f21d5052cdb04dd2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141544 Tested-by: Miklos Vajna <vmiklos@collabora.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/Module_sw.mk1
-rw-r--r--sw/UITest_sw_ui_misc.mk16
-rw-r--r--sw/qa/uitest/ui/misc/misc.py51
3 files changed, 68 insertions, 0 deletions
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 1a4dfd600a5d..a9583fca3bb4 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -200,6 +200,7 @@ $(eval $(call gb_Module_add_uicheck_targets,sw,\
UITest_sw_ui_fmtui \
UITest_sw_ui_index \
UITest_sw_uibase_docvw \
+ UITest_sw_ui_misc \
UITest_sw_uibase_shells \
UITest_classification \
UITest_writer_macro_tests \
diff --git a/sw/UITest_sw_ui_misc.mk b/sw/UITest_sw_ui_misc.mk
new file mode 100644
index 000000000000..13e8e0d073c2
--- /dev/null
+++ b/sw/UITest_sw_ui_misc.mk
@@ -0,0 +1,16 @@
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UITest_UITest,sw_ui_misc))
+
+$(eval $(call gb_UITest_add_modules,sw_ui_misc,$(SRCDIR)/sw/qa/uitest,\
+ ui/misc/ \
+))
+
+$(eval $(call gb_UITest_set_defs,sw_ui_misc, \
+ TDOC="$(SRCDIR)/sw/qa/uitest/data" \
+))
diff --git a/sw/qa/uitest/ui/misc/misc.py b/sw/qa/uitest/ui/misc/misc.py
new file mode 100644
index 000000000000..cf4554ce9638
--- /dev/null
+++ b/sw/qa/uitest/ui/misc/misc.py
@@ -0,0 +1,51 @@
+# -*- 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/.
+#
+
+"""Covers sw/source/ui/misc/ fixes."""
+
+from uitest.framework import UITestCase
+from uitest.uihelper.common import type_text
+
+
+class TestTmpdlg(UITestCase):
+ def test_content_control_dialog(self):
+ with self.ui_test.create_doc_in_start_center("writer") as xComponent:
+ # Insert a dropdown content control, verify that a placeholder item is provided.
+ self.xUITest.executeCommand(".uno:InsertDropdownContentControl")
+ paragraphs = xComponent.Text.createEnumeration()
+ paragraph = paragraphs.nextElement()
+ portions = paragraph.createEnumeration()
+ portion = portions.nextElement()
+ contentControl = portion.ContentControl
+ listItems = contentControl.ListItems
+ self.assertEqual(len(listItems), 1)
+ self.assertEqual(listItems[0][0].Name, "DisplayText")
+ self.assertEqual(listItems[0][0].Value, "")
+ self.assertEqual(listItems[0][1].Name, "Value")
+ self.assertEqual(listItems[0][1].Value, "Choose an item")
+
+ # Append a new list item.
+ with self.ui_test.execute_dialog_through_command(".uno:ContentControlProperties") as xDialog:
+ xAdd = xDialog.getChild("add")
+ with self.ui_test.execute_blocking_action(xAdd.executeAction, args=('CLICK', ())) as xSubDialog:
+ xDisplayName = xSubDialog.getChild("displayname")
+ type_text(xDisplayName, "Foo Bar")
+ xValue = xSubDialog.getChild("value")
+ type_text(xValue, "foo-bar")
+
+ # Verify that the UI appended the list item.
+ listItems = contentControl.ListItems
+ self.assertEqual(len(listItems), 2)
+ self.assertEqual(listItems[1][0].Name, "DisplayText")
+ self.assertEqual(listItems[1][0].Value, "Foo Bar")
+ self.assertEqual(listItems[1][1].Name, "Value")
+ self.assertEqual(listItems[1][1].Value, "foo-bar")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: