Get the style color and number just once
[LibreOffice.git] / sw / qa / uitest / writer_tests7 / tdf139301.py
blob242d638e6fb11c10c5c3c4f276507b6bc32748e9
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
12 class tdf139301(UITestCase):
14 styles = ('Long Dash', 'Long Dash Dot', 'Long Dot', 'Double Dash', 'Double Dash Dot', 'Double Dash Dot Dot', 'Dash', 'Dash Dot', 'Dash Dot Dot', 'Dot')
16 def test_tdf139301(self):
17 with self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx")) as writer_doc:
19 for i in range(len(self.styles)):
20 # select next line shape
21 writer_doc.getCurrentController().select(writer_doc.getDrawPage()[i])
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:
28 # get line style combo box
29 xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
31 # check preset line style
32 style = get_state_as_dict(xLineStyle)['SelectEntryText']
35 self.assertEqual(style, self.styles[i])
37 def test_round_cap(self):
38 with self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_round_cap.docx")) as writer_doc:
40 style_name_extension = ' (Rounded)'
42 for i in range(len(self.styles)):
43 # select next line shape
44 writer_doc.getCurrentController().select(writer_doc.getDrawPage()[i])
46 # wait for available line style setting
47 self.ui_test.wait_until_child_is_available('metricfield')
49 # line setting dialog window
50 with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg:
51 # get line style combo box
52 xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
54 # check preset line style
55 style = get_state_as_dict(xLineStyle)['SelectEntryText']
58 self.assertEqual(style, self.styles[i] + style_name_extension)
60 # vim: set shiftwidth=4 softtabstop=4 expandtab: