| 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.framework import UITestCase |
| 11 |
from uitest.uihelper.common import get_state_as_dict |
| 12 |
from libreoffice.uno.propertyvalue import mkPropertyValues |
| 13 |
from uitest.uihelper.common import change_measurement_unit |
| 14 |
from uitest.uihelper.common import get_url_for_data_file |
| 15 |
|
| 16 |
class tdf119246(UITestCase): |
| 17 |
|
| 18 |
def test_tdf119246(self): |
| 19 |
with self.ui_test.load_file(get_url_for_data_file("tdf119246.odp")) as document: |
| 20 |
|
| 21 |
with change_measurement_unit(self, "Centimeter"): |
| 22 |
|
| 23 |
xImpressDoc = self.xUITest.getTopFocusWindow() |
| 24 |
|
| 25 |
self.assertIsNone(document.CurrentSelection) |
| 26 |
|
| 27 |
xEditWin = xImpressDoc.getChild("impress_win") |
| 28 |
xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"DimensionShape"})) |
| 29 |
self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) |
| 30 |
|
| 31 |
with self.ui_test.execute_dialog_through_command(".uno:MeasureAttributes") as xDialog: |
| 32 |
xLineDist = xDialog.getChild('MTR_LINE_DIST') |
| 33 |
xGuideOvergang = xDialog.getChild('MTR_FLD_HELPLINE_OVERHANG') |
| 34 |
xGuideDist = xDialog.getChild('MTR_FLD_HELPLINE_DIST') |
| 35 |
xLeftDist = xDialog.getChild('MTR_FLD_HELPLINE1_LEN') |
| 36 |
xRightDist = xDialog.getChild('MTR_FLD_HELPLINE2_LEN') |
| 37 |
xDecimalPlace = xDialog.getChild('MTR_FLD_DECIMALPLACES') |
| 38 |
|
| 39 |
# Without the fix in place, this test would have failed with |
| 40 |
# AssertionError: '2.80 cm' != '1.00 cm' |
| 41 |
self.assertEqual("2.80 cm", get_state_as_dict(xLineDist)['Text']) |
| 42 |
self.assertEqual("0.20 cm", get_state_as_dict(xGuideOvergang)['Text']) |
| 43 |
self.assertEqual("0.50 cm", get_state_as_dict(xGuideDist)['Text']) |
| 44 |
self.assertEqual("4.00 cm", get_state_as_dict(xLeftDist)['Text']) |
| 45 |
self.assertEqual("-1.40 cm", get_state_as_dict(xRightDist)['Text']) |
| 46 |
self.assertEqual("2", get_state_as_dict(xDecimalPlace)['Text']) |
| 47 |
|
| 48 |
# vim: set shiftwidth=4 softtabstop=4 expandtab: |