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