Get the style color and number just once
[LibreOffice.git] / sw / qa / uitest / writer_tests6 / tdf157569.py
blob9177047cec51085edd52423776d2a010a4db8688
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_url_for_data_file
11 from libreoffice.uno.propertyvalue import mkPropertyValues
12 import platform
14 class tdf157569(UITestCase):
16 def test_tdf157569(self):
17 with self.ui_test.load_file(get_url_for_data_file("tdf157569.docx")) as document:
19 xShape = document.getDrawPages()[0][0]
20 nHeight = xShape.getSize().Height
21 nWidth = xShape.getSize().Width
23 # Without the fix in place, this test would have failed with
24 # AssertionError: 1663 != 944
25 self.assertEqual(1663, nHeight)
26 if platform.system() == "Windows":
27 self.assertEqual(2155, nWidth) # no idea why it's different on Windows
28 else:
29 self.assertEqual(2118, nWidth)
31 xDoc = self.xUITest.getTopFocusWindow()
32 xEditWin = xDoc.getChild("writer_edit")
34 # Select the formula
35 self.xUITest.executeCommand(".uno:JumpToNextFrame")
36 xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Object1"}))
37 self.assertEqual("SwXTextEmbeddedObject", document.CurrentSelection.getImplementationName())
39 # Go into edit mode
40 xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
42 self.assertEqual(nHeight, xShape.getSize().Height)
43 self.assertEqual(nWidth, xShape.getSize().Width)
45 # leave edit mode
46 xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"ESC"}))
48 self.assertEqual(nHeight, xShape.getSize().Height)
49 self.assertEqual(nWidth, xShape.getSize().Width)
51 # vim: set shiftwidth=4 softtabstop=4 expandtab: