blob: 172589392e4dc94ef3d4cdd89b1c4e44b04e4f8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# -*- 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:
with self.ui_test.create_doc_in_start_center("writer"):
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")
# When inserting a biblio entry field with a page number:
with self.ui_test.execute_blocking_action(new.executeAction, args=('CLICK', ())) as 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())
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")
# vim: set shiftwidth=4 softtabstop=4 expandtab:
|