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/.
9 from uitest
.framework
import UITestCase
10 from uitest
.uihelper
.common
import get_state_as_dict
, get_url_for_data_file
11 from uitest
.uihelper
.common
import select_pos
13 class apply_line_cap(UITestCase
):
15 def test_apply_line_cap(self
):
16 with self
.ui_test
.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx")) as writer_doc
:
18 # check FLAT -> ROUND cap style change by selecting the new 'Rounded' preset line styles
20 # select second line shape (dashDot)
21 writer_doc
.getCurrentController().select(writer_doc
.getDrawPage()[1])
23 # wait for available line style setting
24 self
.ui_test
.wait_until_child_is_available('metricfield')
26 # line setting dialog window
27 with self
.ui_test
.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg
:
29 # get cap style combo box
30 xCapStyle
= xFormatLineDlg
.getChild("LB_CAP_STYLE")
31 cap_style
= get_state_as_dict(xCapStyle
)['SelectEntryText']
33 # get line style combo box
34 xLineStyle
= xFormatLineDlg
.getChild("LB_LINE_STYLE")
36 # select 'Dot (Rounded)', but store the previous value
37 style
= get_state_as_dict(xLineStyle
)['SelectEntryText']
38 select_pos(xLineStyle
, "3")
41 self
.assertEqual(cap_style
, 'Flat')
42 self
.assertEqual(style
, 'Long Dash Dot')
44 # check round cap setting, opening the line style dialog again
45 writer_doc
.getCurrentController().select(writer_doc
.getDrawPage()[1])
47 # wait for available line style setting
48 self
.ui_test
.wait_until_child_is_available('metricfield')
50 # line setting dialog window
51 with self
.ui_test
.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg
:
53 # get cap style combo box
54 xCapStyle
= xFormatLineDlg
.getChild("LB_CAP_STYLE")
55 cap_style
= get_state_as_dict(xCapStyle
)['SelectEntryText']
57 # get line style combo box
58 xLineStyle
= xFormatLineDlg
.getChild("LB_LINE_STYLE")
60 # select 'Dot', but store the previous value
61 style
= get_state_as_dict(xLineStyle
)['SelectEntryText']
62 select_pos(xLineStyle
, "2")
65 # This was 'Flat' (set only dash style of the line style before)
66 self
.assertEqual(cap_style
, 'Round')
67 self
.assertEqual(style
, 'Dot (Rounded)')
69 # 2. check ROUND -> FLAT cap style change
70 writer_doc
.getCurrentController().select(writer_doc
.getDrawPage()[1])
72 # wait for available line style setting
73 self
.ui_test
.wait_until_child_is_available('metricfield')
75 # line setting dialog window
76 with self
.ui_test
.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg
:
78 # get cap style combo box
79 xCapStyle
= xFormatLineDlg
.getChild("LB_CAP_STYLE")
80 cap_style
= get_state_as_dict(xCapStyle
)['SelectEntryText']
82 # get line style combo box
83 xLineStyle
= xFormatLineDlg
.getChild("LB_LINE_STYLE")
85 style
= get_state_as_dict(xLineStyle
)['SelectEntryText']
88 # This was 'Flat' (set only dash style of the line style before)
89 self
.assertEqual(cap_style
, 'Flat')
90 self
.assertEqual(style
, 'Dot')
93 # vim: set shiftwidth=4 softtabstop=4 expandtab: