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 from uitest
.framework
import UITestCase
11 from uitest
.uihelper
.common
import select_pos
, get_state_as_dict
12 from uitest
.uihelper
.common
import select_by_text
14 class tdf125104(UITestCase
):
16 def set_combo_layout_format(self
, dialog
, format
):
17 tabcontrol
= dialog
.getChild("tabcontrol")
18 select_pos(tabcontrol
, "1")
19 comboLayoutFormat
= dialog
.getChild("comboLayoutFormat")
20 select_by_text(comboLayoutFormat
, format
)
22 def test_tdf125104_pageFormat_numbering(self
):
23 with self
.ui_test
.create_doc_in_start_center("writer") as document
:
25 # insert page numbers on multiple pages
26 self
.xUITest
.executeCommand(".uno:InsertPageNumberField")
27 self
.xUITest
.executeCommand(".uno:InsertPagebreak")
28 self
.xUITest
.executeCommand(".uno:InsertPageNumberField")
29 text
= document
.Text
.String
.replace('\r\n', '\n')
30 self
.assertEqual(text
[0:1], "1")
31 self
.assertEqual(text
[2:3], "2")
33 # Bug 125104 - Changing page numbering to "1st, 2nd, 3rd,..." causes crashes when trying to change Page settings later
34 with self
.ui_test
.execute_dialog_through_command(".uno:PageDialog") as xDialog
:
35 self
.set_combo_layout_format(xDialog
, "1st, 2nd, 3rd, ...")
37 text
= document
.Text
.String
.replace('\r\n', '\n')
38 self
.assertEqual(text
[0:3], "1st")
39 self
.assertEqual(text
[4:7], "2nd")
41 with self
.ui_test
.execute_dialog_through_command(".uno:PageDialog", close_button
="cancel") as xDialog
:
42 comboLayoutFormat
= xDialog
.getChild("comboLayoutFormat")
43 self
.assertEqual(get_state_as_dict(comboLayoutFormat
)["SelectEntryText"], "1st, 2nd, 3rd, ...")
45 # change to devanagari alphabet format
46 with self
.ui_test
.execute_dialog_through_command(".uno:PageDialog") as xDialog
:
47 self
.set_combo_layout_format(xDialog
, "क, ख, ग, ...")
49 text
= document
.Text
.String
.replace('\r\n', '\n')
50 self
.assertEqual(text
[0:1], "क")
51 self
.assertEqual(text
[2:3], "ख")
53 # change to devanagari number format
54 with self
.ui_test
.execute_dialog_through_command(".uno:PageDialog") as xDialog
:
55 self
.set_combo_layout_format(xDialog
, "१, २, ३, ...")
57 text
= document
.Text
.String
.replace('\r\n', '\n')
58 self
.assertEqual(text
[0:1], "१")
59 self
.assertEqual(text
[2:3], "२")
62 # vim: set shiftwidth=4 softtabstop=4 expandtab: