diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-04-27 17:11:00 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-04-28 08:24:49 +0200 |
commit | d524f5b28e2b9bcf7ab681eb6ad93a4da3f5663d (patch) | |
tree | a8a5a3a2c0f3068f73a7acd4c899ca7f483dd6a0 /sw/qa | |
parent | c9c6b0d75bcbb6ff3343502a19fb3448d361d335 (diff) |
sw bibliography, refer to a page: add insert/delete UI
If the toggle button's activate state changes, adapt the sensitivity of
the next spinbutton, this way a new page number can be added and an old
one can be deleted.
Change-Id: I97067182e8cd42a02b164ac941598bada2630e07
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114750
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/uitest/ui/index/index.py | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/sw/qa/uitest/ui/index/index.py b/sw/qa/uitest/ui/index/index.py new file mode 100644 index 000000000000..c8309cdc14cc --- /dev/null +++ b/sw/qa/uitest/ui/index/index.py @@ -0,0 +1,61 @@ +# -*- 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/. +# + +"""Covers sw/source/ui/index/ fixes.""" + +from uitest.framework import UITestCase +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import type_text + + +class TestSwuiidxmrk(UITestCase): + + def test_bibliography_page_number_insert(self): + + # Given an empty Writer document: + self.ui_test.create_doc_in_start_center("writer") + + # When inserting a biblio entry field with a page number: + def handle_define_entry(define_entry): + entry = define_entry.getChild("entry") + type_text(entry, "aaa") + listbox = define_entry.getChild("listbox") + select_pos(listbox, "16") # WWW document + pagecb = define_entry.getChild("pagecb-visible") + pagecb.executeAction("CLICK", tuple()) + ok = define_entry.getChild("ok") + self.ui_test.close_dialog_through_button(ok) + + self.ui_test.execute_modeless_dialog_through_command(".uno:InsertAuthoritiesEntry") + insert_entry = self.xUITest.getTopFocusWindow() + from_document = insert_entry.getChild("fromdocument") + from_document.executeAction("CLICK", tuple()) + new = insert_entry.getChild("new") + self.ui_test.execute_blocking_action(new.executeAction, + args=('CLICK', ()), + dialog_handler=handle_define_entry) + insert = insert_entry.getChild("insert") + insert.executeAction("CLICK", tuple()) + close = insert_entry.getChild("close") + self.ui_test.close_dialog_through_button(close) + + # Then make sure the URL contains that page number: + component = self.ui_test.get_component() + paragraphs = component.Text.createEnumeration() + paragraph = paragraphs.nextElement() + portions = paragraph.createEnumeration() + portion = portions.nextElement() + for field in portion.TextField.Fields: + if field.Name != "URL": + continue + # Without the accompanying fix in place, this test would have failed with: + # AssertionError: '' != '#page=1' + # i.e. the page number was not part of the URL. + self.assertEqual(field.Value, "#page=1") + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |