| 1 |
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- |
| 2 |
# |
| 3 |
# This file is part of the LibreOffice project. |
| 4 |
# |
| 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/. |
| 8 |
# |
| 9 |
|
| 10 |
from uitest.uihelper.common import get_state_as_dict |
| 11 |
from libreoffice.uno.propertyvalue import mkPropertyValues |
| 12 |
from uitest.uihelper.common import change_measurement_unit, select_pos |
| 13 |
from uitest.framework import UITestCase |
| 14 |
|
| 15 |
class textColumnsDialog(UITestCase): |
| 16 |
|
| 17 |
def test_textColumnsDialog(self): |
| 18 |
with self.ui_test.create_doc_in_start_center("impress") as document: |
| 19 |
|
| 20 |
xTemplateDlg = self.xUITest.getTopFocusWindow() |
| 21 |
xCancelBtn = xTemplateDlg.getChild("close") |
| 22 |
self.ui_test.close_dialog_through_button(xCancelBtn) |
| 23 |
|
| 24 |
with change_measurement_unit(self, 'Centimeter'): |
| 25 |
xImpressDoc = self.xUITest.getTopFocusWindow() |
| 26 |
|
| 27 |
xEditWin = xImpressDoc.getChild("impress_win") |
| 28 |
xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) |
| 29 |
self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) |
| 30 |
|
| 31 |
# Test defaults and set some values |
| 32 |
with self.ui_test.execute_dialog_through_command(".uno:TextAttributes") as xDialog: |
| 33 |
xTabs = xDialog.getChild("tabcontrol") |
| 34 |
select_pos(xTabs, "2") |
| 35 |
colNumber = xDialog.getChild('FLD_COL_NUMBER') |
| 36 |
colSpacing = xDialog.getChild('MTR_FLD_COL_SPACING') |
| 37 |
self.assertEqual('1', get_state_as_dict(colNumber)['Text']) |
| 38 |
self.assertEqual('0.00 cm', get_state_as_dict(colSpacing)['Text']) |
| 39 |
colNumber.executeAction("SET", mkPropertyValues({"TEXT": "3"})) |
| 40 |
colSpacing.executeAction("SET", mkPropertyValues({"TEXT": "1.5"})) |
| 41 |
|
| 42 |
# Test that settings persist |
| 43 |
with self.ui_test.execute_dialog_through_command(".uno:TextAttributes") as xDialog: |
| 44 |
xTabs = xDialog.getChild("tabcontrol") |
| 45 |
select_pos(xTabs, "2") |
| 46 |
colNumber = xDialog.getChild('FLD_COL_NUMBER') |
| 47 |
colSpacing = xDialog.getChild('MTR_FLD_COL_SPACING') |
| 48 |
self.assertEqual('3', get_state_as_dict(colNumber)['Text']) |
| 49 |
self.assertEqual('1.50 cm', get_state_as_dict(colSpacing)['Text']) |
| 50 |
|
| 51 |
# vim: set shiftwidth=4 softtabstop=4 expandtab: |