1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 """Covers sw/source/ui/index/ fixes."""
12 from uitest
.framework
import UITestCase
13 from uitest
.uihelper
.common
import select_pos
14 from uitest
.uihelper
.common
import type_text
17 class TestSwuiidxmrk(UITestCase
):
19 def test_bibliography_local_page_number_insert(self
):
21 # Given an empty Writer document:
22 with self
.ui_test
.create_doc_in_start_center("writer") as component
:
24 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:InsertAuthoritiesEntry", close_button
="close") as insert_entry
:
25 from_document
= insert_entry
.getChild("fromdocument")
26 from_document
.executeAction("CLICK", tuple())
27 new
= insert_entry
.getChild("new")
29 # When inserting a biblio entry field with a page number:
30 with self
.ui_test
.execute_blocking_action(new
.executeAction
, args
=('CLICK', ())) as define_entry
:
31 entry
= define_entry
.getChild("entry")
32 type_text(entry
, "aaa")
33 listbox
= define_entry
.getChild("listbox")
34 select_pos(listbox
, "16") # WWW document, just select a valid position
35 pagecb
= define_entry
.getChild("pagecb-local-visible")
36 pagecb
.executeAction("CLICK", tuple())
38 insert
= insert_entry
.getChild("insert")
39 insert
.executeAction("CLICK", tuple())
41 # Then make sure the local URL contains that page number:
42 paragraphs
= component
.Text
.createEnumeration()
43 paragraph
= paragraphs
.nextElement()
44 portions
= paragraph
.createEnumeration()
45 portion
= portions
.nextElement()
46 for field
in portion
.TextField
.Fields
:
47 if field
.Name
!= "LocalURL":
49 # Without the accompanying fix in place, this test would have failed with:
50 # Could not find child with id: pagecb-local-visible
51 self
.assertEqual(field
.Value
, "#page=1")
53 # vim: set shiftwidth=4 softtabstop=4 expandtab: