tdf#130857 qt weld: Implement QtInstanceWidget::get_text_height
[LibreOffice.git] / sw / qa / uitest / writer_tests7 / tdf132714.py
blobfdeb4301d2993364c47688cf0e5ddca31c556300
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 from com.sun.star.awt import MouseButton
13 from com.sun.star.awt import MouseEvent
15 class tdf132714(UITestCase):
16 def test_tdf132714(self):
17 with self.ui_test.load_file(get_url_for_data_file("tdf132714.odt")):
19 # delete second row (first data row) in the associated text table of the chart
20 self.xUITest.executeCommand(".uno:GoDown")
21 self.xUITest.executeCommand(".uno:GoDown")
22 self.xUITest.executeCommand(".uno:GoDown")
23 # Without the fix in place, at this point crash occurs.
24 self.xUITest.executeCommand(".uno:DeleteRows")
26 def test_delete_table(self):
27 with self.ui_test.load_file(get_url_for_data_file("tdf132714.odt")) as document:
29 # delete second row (first data row) in the associated text table of the chart
30 self.xUITest.executeCommand(".uno:GoDown")
31 self.xUITest.executeCommand(".uno:GoDown")
32 # Without the fix in place, at this point crash occurs.
33 self.xUITest.executeCommand(".uno:DeleteTable")
35 # select embedded chart
36 self.assertEqual(1, len(document.EmbeddedObjects))
37 document.CurrentController.select(document.getEmbeddedObjects()[0])
38 self.assertEqual("SwXTextEmbeddedObject", document.CurrentSelection.getImplementationName())
40 xChartMainTop = self.xUITest.getTopFocusWindow()
41 xWriterEdit = xChartMainTop.getChild("writer_edit")
42 # edit object by pressing Enter
43 xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
45 # create mouse event in the chart area
46 xFrame = document.getCurrentController().getFrame()
47 self.assertIsNotNone(xFrame)
48 xWindow = xFrame.getContainerWindow()
49 self.assertIsNotNone(xWindow)
51 xMouseEvent = MouseEvent()
52 xMouseEvent.Modifiers = 0
53 xMouseEvent.Buttons = MouseButton.LEFT
54 xMouseEvent.X = 1000
55 xMouseEvent.Y = 400
56 xMouseEvent.ClickCount = 1
57 xMouseEvent.PopupTrigger = False
58 xMouseEvent.Source = xWindow
60 # send mouse event
61 xToolkitRobot = xWindow.getToolkit()
62 self.assertIsNotNone(xToolkitRobot)
64 # Click in the chart area
66 # Without the fix in place, this test would have crashed here
67 xToolkitRobot.mouseMove(xMouseEvent)
69 def test_data_ranges(self):
70 with self.ui_test.load_file(get_url_for_data_file("tdf132714.odt")) as document:
72 # delete second row (first data row) in the associated text table of the chart
73 self.xUITest.executeCommand(".uno:GoDown")
74 self.xUITest.executeCommand(".uno:GoDown")
75 # Without the fix in place, at this point crash occurs.
76 self.xUITest.executeCommand(".uno:DeleteTable")
78 # select embedded chart
79 self.assertEqual(1, len(document.EmbeddedObjects))
80 document.CurrentController.select(document.EmbeddedObjects[0])
81 self.assertEqual("SwXTextEmbeddedObject", document.CurrentSelection.getImplementationName())
83 xChartMainTop = self.xUITest.getTopFocusWindow()
84 xWriterEdit = xChartMainTop.getChild("writer_edit")
85 # edit object by pressing Enter
86 xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
88 # open DataRanges dialog window
89 xChartMain = xChartMainTop.getChild("chart_window")
90 xSeriesObj = xChartMain.getChild("CID/Page=")
92 # Without the fix in place, this test would have crashed here
93 with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"})):
94 pass
97 # vim: set shiftwidth=4 softtabstop=4 expandtab: