| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
from uitest.framework import UITestCase |
| 10 |
from uitest.uihelper.common import get_url_for_data_file, get_state_as_dict |
| 11 |
|
| 12 |
from libreoffice.uno.propertyvalue import mkPropertyValues |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
class tdf75509(UITestCase): |
| 17 |
def test_tdf75509(self): |
| 18 |
|
| 19 |
|
| 20 |
and the |
| 21 |
ale. |
| 22 |
with self.ui_test.load_file(get_url_for_data_file("tdf75509.odb")) as document: |
| 23 |
xDbWindow = self.xUITest.getTopFocusWindow() |
| 24 |
|
| 25 |
self.xUITest.executeCommand(".uno:DBViewTables") |
| 26 |
|
| 27 |
|
| 28 |
xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') |
| 29 |
xToolkit.waitUntilAllIdlesDispatched() |
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
self.xUITest.executeCommand(".uno:SelectAll") |
| 36 |
|
| 37 |
with self.ui_test.open_subcomponent_through_command(".uno:DBTableEdit") as xTableFrame: |
| 38 |
xTableWindow = self.xUITest.getWindow(xTableFrame.getContainerWindow()) |
| 39 |
|
| 40 |
xTableEditor = xTableWindow.getChild("DBTableEditor") |
| 41 |
|
| 42 |
row |
| 43 |
xTableEditor.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) |
| 44 |
|
| 45 |
|
| 46 |
xDefaultValue = xTableWindow.getChild("DefaultValue") |
| 47 |
|
| 48 |
xDefaultValue.executeAction("FOCUS", tuple()) |
| 49 |
xDefaultValue.executeAction("SET", mkPropertyValues({"TEXT": "3,14"})) |
| 50 |
|
| 51 |
|
| 52 |
xTableEditor.executeAction("FOCUS", tuple()) |
| 53 |
|
| 54 |
|
| 55 |
xFormatText = xTableWindow.getChild("FormatText") |
| 56 |
self.assertEqual(get_state_as_dict(xFormatText)["Text"], "3,14") |
| 57 |
|
| 58 |
d" |
| 59 |
xTableEditor.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) |
| 60 |
|
| 61 |
ator |
| 62 |
xDefaultValue.executeAction("FOCUS", tuple()) |
| 63 |
xDefaultValue.executeAction("SET", mkPropertyValues({"TEXT": "2.72"})) |
| 64 |
xTableEditor.executeAction("FOCUS", tuple()) |
| 65 |
self.assertEqual(get_state_as_dict(xFormatText)["Text"], "2.72") |
| 66 |
|
| 67 |
|
| 68 |
self.xUITest.executeCommandForProvider(".uno:Save", xTableFrame) |
| 69 |
|
| 70 |
with self.ui_test.open_subcomponent_through_command(".uno:DBTableOpen") as xTableFrame: |
| 71 |
xTableWindow = self.xUITest.getWindow(xTableFrame.getContainerWindow()) |
| 72 |
|
| 73 |
able |
| 74 |
xGrid = xTableWindow.getChild("DBGrid") |
| 75 |
xGrid.executeAction("FOCUS", tuple()) |
| 76 |
xGrid.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) |
| 77 |
|
| 78 |
|
| 79 |
xEdit = self.xUITest.getFocusWindow() |
| 80 |
self.assertEqual(get_state_as_dict(xEdit)["Text"], "3,14") |
| 81 |
|
| 82 |
able |
| 83 |
xGrid.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) |
| 84 |
|
| 85 |
|
| 86 |
xEdit = self.xUITest.getFocusWindow() |
| 87 |
self.assertEqual(get_state_as_dict(xEdit)["Text"], "2.72") |
| 88 |
|
| 89 |
|
| 90 |
xEdit.executeAction("SET", mkPropertyValues({"TEXT": "2.71"})) |
| 91 |
|
| 92 |
self.xUITest.executeCommandForProvider(".uno:RecSave", xTableFrame) |
| 93 |
|
| 94 |
|
| 95 |
xDbController = self.ui_test.get_desktop().getActiveFrame().getController() |
| 96 |
xConnection = xDbController.ActiveConnection |
| 97 |
xStatement = xConnection.createStatement() |
| 98 |
xResultSet = xStatement.executeQuery("SELECT \"FrenchField\", \"EnglishField\" " |
| 99 |
"FROM \"Table1\"") |
| 100 |
self.assertTrue(xResultSet.next()) |
| 101 |
self.assertEqual(xResultSet.getString(1), "3.14") |
| 102 |
self.assertEqual(xResultSet.getString(2), "2.71") |
| 103 |
|
| 104 |
|