diff options
Diffstat (limited to '')
-rw-r--r-- | sw/qa/uitest/table/splitTable.py | 94 | ||||
-rw-r--r-- | sw/qa/uitest/table/tableProperties.py | 247 | ||||
-rw-r--r-- | sw/qa/uitest/table/tableToText.py | 88 | ||||
-rw-r--r-- | sw/qa/uitest/table/tdf115026.py | 38 | ||||
-rw-r--r-- | sw/qa/uitest/table/tdf116737.py | 54 | ||||
-rwxr-xr-x | sw/qa/uitest/table/tdf128593.py | 39 | ||||
-rw-r--r-- | sw/qa/uitest/table/tdf81292.py | 49 | ||||
-rw-r--r-- | sw/qa/uitest/table/tdf99334.py | 47 | ||||
-rw-r--r-- | sw/qa/uitest/table/textToTable.py | 79 |
9 files changed, 735 insertions, 0 deletions
diff --git a/sw/qa/uitest/table/splitTable.py b/sw/qa/uitest/table/splitTable.py new file mode 100644 index 000000000..589673b2b --- /dev/null +++ b/sw/qa/uitest/table/splitTable.py @@ -0,0 +1,94 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Writer Split Table + +class splitTable(UITestCase): + def test_split_table(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #go to row 2 + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + #dialog Split table, check Copy heading, OK -> verify 2 tables, 1st has 2 rows, second has 5 rows + self.ui_test.execute_dialog_through_command(".uno:SplitTable") + xDialog = self.xUITest.getTopFocusWindow() + + copyheading = xDialog.getChild("copyheading") + copyheading.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.assertEqual(document.TextTables.getCount(), 2) + tables = document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 2) + self.assertEqual(len(tables[1].getRows()), 5) + #undo -> verify 1 tables + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 1) + + self.ui_test.close_doc() + + #dialog Split table, check Custom heading, OK -> verify 2 tables, 1st has 2 rows, second has 4 rows + writer_doc = self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #go to row 2 + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + self.ui_test.execute_dialog_through_command(".uno:SplitTable") + xDialog = self.xUITest.getTopFocusWindow() + + customheading = xDialog.getChild("customheading") + customheading.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.assertEqual(document.TextTables.getCount(), 2) + tables = document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 2) + self.assertEqual(len(tables[1].getRows()), 4) + #undo -> verify 1 tables + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 1) + + self.ui_test.close_doc() + #dialog Split table, check No heading, OK -> verify 2 tables, 1st has 2 rows, second has 4 rows + writer_doc = self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #go to row 2 + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + self.ui_test.execute_dialog_through_command(".uno:SplitTable") + xDialog = self.xUITest.getTopFocusWindow() + + noheading = xDialog.getChild("noheading") + noheading.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.assertEqual(document.TextTables.getCount(), 2) + tables = document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 2) + self.assertEqual(len(tables[1].getRows()), 4) + #undo -> verify 1 tables + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 1) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tableProperties.py b/sw/qa/uitest/table/tableProperties.py new file mode 100644 index 000000000..c0c1cd9de --- /dev/null +++ b/sw/qa/uitest/table/tableProperties.py @@ -0,0 +1,247 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Writer Table Properties + +class tableProperties(UITestCase): + def test_table_properties(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #set cm + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() + + xPages = xDialog.getChild("pages") + xWriterEntry = xPages.getChild('3') # Writer + xWriterEntry.executeAction("EXPAND", tuple()) + xWriterGeneralEntry = xWriterEntry.getChild('0') + xWriterGeneralEntry.executeAction("SELECT", tuple()) #General + xMetric = xDialog.getChild("metric") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #dialog Table Properties - Table + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + name = xDialog.getChild("name") + free = xDialog.getChild("free") + widthmf = xDialog.getChild("widthmf") + leftmf = xDialog.getChild("leftmf") + rightmf = xDialog.getChild("rightmf") + abovemf = xDialog.getChild("abovemf") + belowmf = xDialog.getChild("belowmf") + textdirection = xDialog.getChild("textdirection") + + name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + name.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"})) + free.executeAction("CLICK", tuple()) + widthmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + widthmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + widthmf.executeAction("TYPE", mkPropertyValues({"TEXT":"15"})) + leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + leftmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + rightmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + abovemf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + abovemf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + abovemf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + belowmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + belowmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + belowmf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + props = {"TEXT": "Left-to-right (LTR)"} + actionProps = mkPropertyValues(props) + textdirection.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + name = xDialog.getChild("name") + free = xDialog.getChild("free") + widthmf = xDialog.getChild("widthmf") + leftmf = xDialog.getChild("leftmf") + rightmf = xDialog.getChild("rightmf") + abovemf = xDialog.getChild("abovemf") + belowmf = xDialog.getChild("belowmf") + textdirection = xDialog.getChild("textdirection") + + self.assertEqual(get_state_as_dict(name)["Text"], "NewName") + self.assertEqual(get_state_as_dict(free)["Checked"], "true") + self.assertEqual(get_state_as_dict(widthmf)["Text"], "15.00 cm") + self.assertEqual(get_state_as_dict(leftmf)["Text"], "1.00 cm") + self.assertEqual(get_state_as_dict(rightmf)["Text"], "1.00 cm") + self.assertEqual(get_state_as_dict(abovemf)["Text"], "1.00 cm") + self.assertEqual(get_state_as_dict(belowmf)["Text"], "1.00 cm") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #dialog Table Properties - Text flow + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + xbreak = xDialog.getChild("break") + xbreak.executeAction("CLICK", tuple()) + column = xDialog.getChild("column") + column.executeAction("CLICK", tuple()) + after = xDialog.getChild("after") + after.executeAction("CLICK", tuple()) + keep = xDialog.getChild("keep") + keep.executeAction("CLICK", tuple()) + headline = xDialog.getChild("headline") + headline.executeAction("CLICK", tuple()) + textdirection = xDialog.getChild("textorientation") + props = {"TEXT": "Vertical (bottom to top)"} + actionProps = mkPropertyValues(props) + textdirection.executeAction("SELECT", actionProps) + vertorient = xDialog.getChild("vertorient") + props2 = {"TEXT": "Bottom"} + actionProps2 = mkPropertyValues(props2) + vertorient.executeAction("SELECT", actionProps2) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + xbreak = xDialog.getChild("break") + self.assertEqual(get_state_as_dict(xbreak)["Selected"], "true") + column = xDialog.getChild("column") + self.assertEqual(get_state_as_dict(column)["Checked"], "true") + after = xDialog.getChild("column") + self.assertEqual(get_state_as_dict(after)["Checked"], "true") + keep = xDialog.getChild("keep") + self.assertEqual(get_state_as_dict(keep)["Selected"], "true") + headline = xDialog.getChild("headline") + self.assertEqual(get_state_as_dict(headline)["Selected"], "true") + textdirection = xDialog.getChild("textorientation") + self.assertEqual(get_state_as_dict(textdirection)["SelectEntryText"], "Vertical (bottom to top)") + vertorient = xDialog.getChild("vertorient") + self.assertEqual(get_state_as_dict(vertorient)["SelectEntryText"], "Bottom") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #dialog Table Properties - Columns + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") + + adaptwidth = xDialog.getChild("adaptwidth") + adaptwidth.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + #doesn't work / probably Bug 100537 - Width and relative checkboxes disabled in Table + #dialog by default with automatic alignment +# self.ui_test.execute_dialog_through_command(".uno:TableDialog") +# xDialog = self.xUITest.getTopFocusWindow() +# tabcontrol = xDialog.getChild("tabcontrol") +# select_pos(tabcontrol, "2") +# adaptwidth = xDialog.getChild("adaptwidth") +# self.assertEqual(get_state_as_dict(adaptwidth)["Selected"], "true") +# xOKBtn = xDialog.getChild("ok") +# self.ui_test.close_dialog_through_button(xOKBtn) + + #dialog Table Properties - Borders + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "3") + + sync = xDialog.getChild("sync") + mergeadjacent = xDialog.getChild("mergeadjacent") + sync.executeAction("CLICK", tuple()) + mergeadjacent.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #verify + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "3") + sync = xDialog.getChild("sync") + mergeadjacent = xDialog.getChild("mergeadjacent") +# self.assertEqual(get_state_as_dict(sync)["Selected"], "false") #need change spacing, but ui names are not unique + self.assertEqual(get_state_as_dict(mergeadjacent)["Selected"], "false") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #dialog Table Properties - Background + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "4") + + btncolor = xDialog.getChild("btncolor") + btncolor.executeAction("CLICK", tuple()) + R_custom = xDialog.getChild("R_custom") + G_custom = xDialog.getChild("G_custom") + B_custom = xDialog.getChild("B_custom") + R_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + R_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + R_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"})) + G_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + G_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + G_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"})) + B_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + B_custom.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + B_custom.executeAction("TYPE", mkPropertyValues({"TEXT":"100"})) + B_custom.executeAction("UP", tuple()) + B_custom.executeAction("DOWN", tuple()) #need to refresh HEX value... + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #verify + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "4") + btncolor = xDialog.getChild("btncolor") + btncolor.executeAction("CLICK", tuple()) + R_custom = xDialog.getChild("R_custom") + G_custom = xDialog.getChild("G_custom") + B_custom = xDialog.getChild("B_custom") + + self.assertEqual(get_state_as_dict(R_custom)["Text"], "100") + self.assertEqual(get_state_as_dict(B_custom)["Text"], "100") + self.assertEqual(get_state_as_dict(G_custom)["Text"], "100") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tableToText.py b/sw/qa/uitest/table/tableToText.py new file mode 100644 index 000000000..f47eeeef2 --- /dev/null +++ b/sw/qa/uitest/table/tableToText.py @@ -0,0 +1,88 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Writer Table to text + +class tableToText(UITestCase): + def test_table_to_text(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #dialog Table to text - Tabs; verify + self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") + xDialog = self.xUITest.getTopFocusWindow() + tabs = xDialog.getChild("tabs") + tabs.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(document.Text.String[0:3], "a\ta") + self.assertEqual(document.TextTables.getCount(), 0) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 1) + + #dialog Table to text - Paragraph; verify + self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") + xDialog = self.xUITest.getTopFocusWindow() + paragraph = xDialog.getChild("paragraph") + paragraph.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:4], "a\na\n") + self.assertEqual(document.TextTables.getCount(), 0) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 1) + + #dialog Table to text - Semicolons; verify + self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") + xDialog = self.xUITest.getTopFocusWindow() + semicolons = xDialog.getChild("semicolons") + semicolons.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:6], "a;a\n;\n") + self.assertEqual(document.TextTables.getCount(), 0) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 1) + + #dialog Table to text - other; verify + self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") + xDialog = self.xUITest.getTopFocusWindow() + other = xDialog.getChild("other") + other.executeAction("CLICK", tuple()) + othered = xDialog.getChild("othered") + othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + othered.executeAction("TYPE", mkPropertyValues({"TEXT":":"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(document.Text.String.replace('\r\n', '\n')[0:6], "a:a\n:\n") + self.assertEqual(document.TextTables.getCount(), 0) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 1) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf115026.py b/sw/qa/uitest/table/tdf115026.py new file mode 100644 index 000000000..610804948 --- /dev/null +++ b/sw/qa/uitest/table/tdf115026.py @@ -0,0 +1,38 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.path import get_srcdir_url +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict + +class tdf115026(UITestCase): + + def test_pageBreak_and_tableAutoFormat(self): + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + self.xUITest.executeCommand(".uno:InsertPagebreak") + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.execute_dialog_through_command(".uno:AutoFormat") + xDialog = self.xUITest.getTopFocusWindow() + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf116737.py b/sw/qa/uitest/table/tdf116737.py new file mode 100644 index 000000000..7b27020e4 --- /dev/null +++ b/sw/qa/uitest/table/tdf116737.py @@ -0,0 +1,54 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + +#Bug 116737 - INSERT TABLE: Can't select table style (gen/gtk) +class tdf116737(UITestCase): + def test_tdf116737_select_table_style(self): + + self.ui_test.create_doc_in_start_center("writer") + xWriterDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + + #Insert => Insert Table / It's not possible to select a table style + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + xDialog = self.xUITest.getTopFocusWindow() + + formatlbinstable = xDialog.getChild("formatlbinstable") + entry = formatlbinstable.getChild("11") #Simple List Shaded + entry.executeAction("SELECT", tuple()) + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + #verify .uno:TableDialog + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") #tab Background + + btncolor = xDialog.getChild("btncolor") + btncolor.executeAction("CLICK", tuple()) + + R_custom = xDialog.getChild("R_custom") + G_custom = xDialog.getChild("G_custom") + B_custom = xDialog.getChild("B_custom") + #"Simple List Shaded" -> header should be black + self.assertEqual(get_state_as_dict(R_custom)["Text"], "0") + self.assertEqual(get_state_as_dict(G_custom)["Text"], "0") + self.assertEqual(get_state_as_dict(B_custom)["Text"], "0") + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf128593.py b/sw/qa/uitest/table/tdf128593.py new file mode 100755 index 000000000..26f9d903b --- /dev/null +++ b/sw/qa/uitest/table/tdf128593.py @@ -0,0 +1,39 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +import importlib +from uitest.uihelper.common import get_state_as_dict + +#https://bugs.documentfoundation.org/show_bug.cgi?id=128593 +#Bug 128593 - Writer table cell's background color is always black + +class tdf128593(UITestCase): + def test_tdf128593_table_background_color(self): + MainDoc = self.ui_test.create_doc_in_start_center("writer") + MainWindow = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_dialog_through_command(".uno:InsertTable") + InsertTableDialog = self.xUITest.getTopFocusWindow() + xok = InsertTableDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xok) + + self.xUITest.executeCommandWithParameters(".uno:TableCellBackgroundColor", mkPropertyValues({"TableCellBackgroundColor" : 16776960 }) ) + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + writer_edit = MainWindow.getChild("writer_edit") + writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "0", "START_POS": "0"})) + TablePropertiesDialog = self.xUITest.getTopFocusWindow() + tabcontrol = TablePropertiesDialog.getChild("tabcontrol") + tabcontrol.executeAction("SELECT", mkPropertyValues({"POS": "4"})) + Rcustom = TablePropertiesDialog.getChild("R_custom") #255 + self.assertEqual(get_state_as_dict(Rcustom)["Text"], "255") + Gcustom = TablePropertiesDialog.getChild("G_custom") #255 + self.assertEqual(get_state_as_dict(Gcustom)["Text"], "255") + Bcustom = TablePropertiesDialog.getChild("B_custom") #0 + self.assertEqual(get_state_as_dict(Bcustom)["Text"], "0") + xok = TablePropertiesDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xok) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf81292.py b/sw/qa/uitest/table/tdf81292.py new file mode 100644 index 000000000..019219f41 --- /dev/null +++ b/sw/qa/uitest/table/tdf81292.py @@ -0,0 +1,49 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +import time +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + +#Bug 81292 - TABLE: Crashes on sorting table + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf81292(UITestCase): + + def test_tdf81292_table_sort(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf81292.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #select whole table + self.xUITest.executeCommand(".uno:SelectTable") + #Tools - Sort + self.ui_test.execute_dialog_through_command(".uno:SortDialog") + xDialog = self.xUITest.getTopFocusWindow() + xDown = xDialog.getChild("down1") + xDown.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #verify + tables = document.getTextTables() + table = tables[0] + tableText = table.getCellByName("B3") + b3 = tableText.getString() + tableTextc1 = table.getCellByName("C1").getString() + self.assertEqual(b3, "https://www.hightail.com/") + self.assertEqual(tableTextc1, "inlognaam") + #undo + self.xUITest.executeCommand(".uno:Undo") + b3 = tableText.getString() + self.assertEqual(b3, "www.comicstripshop.com") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf99334.py b/sw/qa/uitest/table/tdf99334.py new file mode 100644 index 000000000..de013a1e8 --- /dev/null +++ b/sw/qa/uitest/table/tdf99334.py @@ -0,0 +1,47 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +import time +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + +#Bug 99334 - Crashes when sorting table by columns with umlauts + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf99334(UITestCase): + + def test_tdf99334_table_sort_umlauts(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf99334.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + #select whole table + self.xUITest.executeCommand(".uno:SelectTable") + #Tools - Sort + self.ui_test.execute_dialog_through_command(".uno:SortDialog") + xDialog = self.xUITest.getTopFocusWindow() + # xDown = xDialog.getChild("down1") + # xDown.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #verify + tables = document.getTextTables() + table = tables[0] + tableText = table.getCellByName("B1") + b1 = tableText.getString() + self.assertEqual(b1, "two") + #undo + self.xUITest.executeCommand(".uno:Undo") + b1 = tableText.getString() + self.assertEqual(b1, "one") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/textToTable.py b/sw/qa/uitest/table/textToTable.py new file mode 100644 index 000000000..7d89a42d9 --- /dev/null +++ b/sw/qa/uitest/table/textToTable.py @@ -0,0 +1,79 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Writer Text to table + +class textToTable(UITestCase): + def test_text_to_table(self): + writer_doc = self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #Enter A;B ; select the text ; dialog Text to table - Semicolon; verify + type_text(xWriterEdit, "A;B;C") + xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "5"})) + self.ui_test.execute_dialog_through_command(".uno:ConvertTextToTable") + xDialog = self.xUITest.getTopFocusWindow() + semicolons = xDialog.getChild("semicolons") + semicolons.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(document.TextTables.getCount(), 1) + tables = document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 1) + self.assertEqual(len(tables[0].getColumns()), 3) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 0) + self.assertEqual(document.Text.String[0:5], "A;B;C") + + self.ui_test.close_doc() + + def test_text_to_table_header(self): + writer_doc = self.ui_test.load_file(get_url_for_data_file("textToTable.odt")) + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #open file; select all text ; dialog Text to table - other ":"; verify + self.xUITest.executeCommand(".uno:SelectAll") + self.ui_test.execute_dialog_through_command(".uno:ConvertTextToTable") + xDialog = self.xUITest.getTopFocusWindow() + other = xDialog.getChild("other") + other.executeAction("CLICK", tuple()) + othered = xDialog.getChild("othered") + othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + othered.executeAction("TYPE", mkPropertyValues({"TEXT":":"})) + headingcb = xDialog.getChild("headingcb") + headingcb.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(document.TextTables.getCount(), 1) + tables = document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 4) + self.assertEqual(len(tables[0].getColumns()), 3) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextTables.getCount(), 0) + self.assertEqual(document.Text.String[0:5], "A:B:C") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: |