diff options
Diffstat (limited to 'sw/qa/uitest/table')
-rw-r--r-- | sw/qa/uitest/table/sheetToTable.py | 117 | ||||
-rw-r--r-- | sw/qa/uitest/table/splitTable.py | 120 | ||||
-rw-r--r-- | sw/qa/uitest/table/tableProperties.py | 407 | ||||
-rw-r--r-- | sw/qa/uitest/table/tableToText.py | 119 | ||||
-rw-r--r-- | sw/qa/uitest/table/tdf134881_colProportionalAdjust.py | 64 | ||||
-rw-r--r-- | sw/qa/uitest/table/tdf135693.py | 28 | ||||
-rw-r--r-- | sw/qa/uitest/table/tdf81292.py | 49 | ||||
-rw-r--r-- | sw/qa/uitest/table/tdf99334.py | 45 | ||||
-rw-r--r-- | sw/qa/uitest/table/textToTable.py | 55 |
9 files changed, 492 insertions, 512 deletions
diff --git a/sw/qa/uitest/table/sheetToTable.py b/sw/qa/uitest/table/sheetToTable.py index 7beff37c6c8d..4f48eeb644db 100644 --- a/sw/qa/uitest/table/sheetToTable.py +++ b/sw/qa/uitest/table/sheetToTable.py @@ -13,58 +13,52 @@ from uitest.uihelper.calc import enter_text_to_cell class sheetToTable(UITestCase): def test_sheet_to_table_without_hidden_rows(self): - calc_doc = self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods")) - xCalcDoc = self.xUITest.getTopFocusWindow() - self.xUITest.executeCommand(".uno:SelectAll") - self.xUITest.executeCommand(".uno:Copy") - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - self.ui_test.close_doc() - writer_doc = self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - self.xUITest.executeCommand(".uno:Paste") - #verify (don't copy hidden cells) - self.assertEqual(document.TextTables.getCount(), 1) - table = document.getTextTables()[0] - # This was 3 (copied hidden row) - self.assertEqual(len(table.getRows()), 2) - self.assertEqual(table.getCellByName("A1").getString(), "1") - # This was "2 (hidden)" (copied hidden row) - self.assertEqual(table.getCellByName("A2").getString(), "3") - self.ui_test.close_doc() + with self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc: + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + self.xUITest.executeCommand(".uno:Paste") + #verify (don't copy hidden cells) + self.assertEqual(document.TextTables.getCount(), 1) + table = document.getTextTables()[0] + # This was 3 (copied hidden row) + self.assertEqual(len(table.getRows()), 2) + self.assertEqual(table.getCellByName("A1").getString(), "1") + # This was "2 (hidden)" (copied hidden row) + self.assertEqual(table.getCellByName("A2").getString(), "3") def test_tdf138688(self): - calc_doc = self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods")) - xCalcDoc = self.xUITest.getTopFocusWindow() - self.xUITest.executeCommand(".uno:SelectAll") - self.xUITest.executeCommand(".uno:Copy") - gridwin = xCalcDoc.getChild("grid_window") - document = self.ui_test.get_component() - self.ui_test.close_doc() - 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 numbering in the paragraph after the table - self.xUITest.executeCommand(".uno:GoDown") - self.xUITest.executeCommand(".uno:GoDown") - self.xUITest.executeCommand(".uno:DefaultNumbering") - self.xUITest.executeCommand(".uno:GoUp") - self.xUITest.executeCommand(".uno:GoUp") - - #verify (this was a freezing/crash) - self.xUITest.executeCommand(".uno:Paste") - - #verify also tdf#124646 (don't copy hidden cells) - self.assertEqual(document.TextTables.getCount(), 1) - table = document.getTextTables()[0] - # This was 3 (copied hidden row) - self.assertEqual(len(table.getRows()), 2) - self.assertEqual(table.getCellByName("A1").getString(), "1") - # This was "2 (hidden)" (copied hidden row) - self.assertEqual(table.getCellByName("A2").getString(), "3") - self.ui_test.close_doc() + with self.ui_test.load_file(get_url_for_data_file("hiddenRow.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc: + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + # set numbering in the paragraph after the table + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:DefaultNumbering") + self.xUITest.executeCommand(".uno:GoUp") + self.xUITest.executeCommand(".uno:GoUp") + + #verify (this was a freezing/crash) + self.xUITest.executeCommand(".uno:Paste") + + #verify also tdf#124646 (don't copy hidden cells) + self.assertEqual(document.TextTables.getCount(), 1) + table = document.getTextTables()[0] + # This was 3 (copied hidden row) + self.assertEqual(len(table.getRows()), 2) + self.assertEqual(table.getCellByName("A1").getString(), "1") + # This was "2 (hidden)" (copied hidden row) + self.assertEqual(table.getCellByName("A2").getString(), "3") def test_tdf129083(self): calc_doc = self.ui_test.create_doc_in_start_center("calc") @@ -84,17 +78,16 @@ class sheetToTable(UITestCase): self.ui_test.close_doc() - writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf129083.odt")) - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() + with self.ui_test.load_file(get_url_for_data_file("tdf129083.odt")) as writer_doc: + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() - self.xUITest.executeCommand(".uno:Paste") + self.xUITest.executeCommand(".uno:Paste") - self.assertEqual(document.TextTables.getCount(), 1) - table = document.getTextTables()[0] - self.assertEqual(len(table.getRows()), 4) - self.assertEqual(table.getCellByName("A1").getString(), "Test 1") - self.assertEqual(table.getCellByName("A2").getString(), "Test 2") - self.assertEqual(table.getCellByName("A3").getString(), "Test 3") - self.assertEqual(table.getCellByName("A4").getString(), "Test 4") - self.ui_test.close_doc() + self.assertEqual(document.TextTables.getCount(), 1) + table = document.getTextTables()[0] + self.assertEqual(len(table.getRows()), 4) + self.assertEqual(table.getCellByName("A1").getString(), "Test 1") + self.assertEqual(table.getCellByName("A2").getString(), "Test 2") + self.assertEqual(table.getCellByName("A3").getString(), "Test 3") + self.assertEqual(table.getCellByName("A4").getString(), "Test 4") diff --git a/sw/qa/uitest/table/splitTable.py b/sw/qa/uitest/table/splitTable.py index 402aab45d543..e4fdecac6fa0 100644 --- a/sw/qa/uitest/table/splitTable.py +++ b/sw/qa/uitest/table/splitTable.py @@ -11,74 +11,70 @@ from uitest.uihelper.common import get_url_for_data_file 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() + with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc: + 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() + 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) #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() + with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc: + 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) + 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() + with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc: + 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) + 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 index da75f2218255..4c2b34ab0a16 100644 --- a/sw/qa/uitest/table/tableProperties.py +++ b/sw/qa/uitest/table/tableProperties.py @@ -15,208 +15,207 @@ from uitest.uihelper.common import change_measurement_unit 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() - - change_measurement_unit(self, "Centimeter") - - #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"})) - select_by_text(textdirection, "Left-to-right (LTR)") - 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") - select_by_text(textdirection, "Vertical (bottom to top)") - vertorient = xDialog.getChild("vertorient") - select_by_text(vertorient, "Bottom") - 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() + with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc: + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + change_measurement_unit(self, "Centimeter") + + #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"})) + select_by_text(textdirection, "Left-to-right (LTR)") + 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") + select_by_text(textdirection, "Vertical (bottom to top)") + vertorient = xDialog.getChild("vertorient") + select_by_text(vertorient, "Bottom") + 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) + # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tableToText.py b/sw/qa/uitest/table/tableToText.py index f131f914c93e..110a3e0837d6 100644 --- a/sw/qa/uitest/table/tableToText.py +++ b/sw/qa/uitest/table/tableToText.py @@ -12,68 +12,67 @@ from uitest.uihelper.common import get_url_for_data_file 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) + with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc: + 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 - 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 - 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) + #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/tdf134881_colProportionalAdjust.py b/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py index 019c492374a1..ff34dd75e9d0 100644 --- a/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py +++ b/sw/qa/uitest/table/tdf134881_colProportionalAdjust.py @@ -14,38 +14,36 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf134881(UITestCase): def test_tdf134881(self): - writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf134881_colProportionalAdjust.odt")) - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - - change_measurement_unit(self, "Centimeter") - - #dialog Table Properties - self.ui_test.execute_dialog_through_command(".uno:TableDialog") - xDialog = self.xUITest.getTopFocusWindow() - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "2") #columns - - adaptcolumns = xDialog.getChild("adaptcolumns") - width1 = xDialog.getChild("width1") - width2 = xDialog.getChild("width2") - # Get the baseline. The first column is much shorter than the second. - self.assertEqual((get_state_as_dict(width1)["Text"])[0:3], "3.0") - self.assertEqual((get_state_as_dict(width2)["Text"])[0:4], "14.0") - # Set proportional adjust - so all columns are affected. - adaptcolumns.executeAction("CLICK", tuple()) - # Cut the second column in half. - width2.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - width2.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - width2.executeAction("TYPE", mkPropertyValues({"TEXT":"7"})) - width2.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - - # The first column should now be half it's original value, not zero (not 3 - 7) - self.assertEqual((get_state_as_dict(width1)["Text"])[0:2], "1.") #1.5 - - xOKBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xOKBtn) - - self.ui_test.close_doc() + with self.ui_test.load_file(get_url_for_data_file("tdf134881_colProportionalAdjust.odt")) as writer_doc: + document = self.ui_test.get_component() + xWriterDoc = self.xUITest.getTopFocusWindow() + + change_measurement_unit(self, "Centimeter") + + #dialog Table Properties + self.ui_test.execute_dialog_through_command(".uno:TableDialog") + xDialog = self.xUITest.getTopFocusWindow() + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") #columns + + adaptcolumns = xDialog.getChild("adaptcolumns") + width1 = xDialog.getChild("width1") + width2 = xDialog.getChild("width2") + # Get the baseline. The first column is much shorter than the second. + self.assertEqual((get_state_as_dict(width1)["Text"])[0:3], "3.0") + self.assertEqual((get_state_as_dict(width2)["Text"])[0:4], "14.0") + # Set proportional adjust - so all columns are affected. + adaptcolumns.executeAction("CLICK", tuple()) + # Cut the second column in half. + width2.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + width2.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + width2.executeAction("TYPE", mkPropertyValues({"TEXT":"7"})) + width2.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + # The first column should now be half it's original value, not zero (not 3 - 7) + self.assertEqual((get_state_as_dict(width1)["Text"])[0:2], "1.") #1.5 + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf135693.py b/sw/qa/uitest/table/tdf135693.py index 39026fcbfd27..f4a0a7b8cfa3 100644 --- a/sw/qa/uitest/table/tdf135693.py +++ b/sw/qa/uitest/table/tdf135693.py @@ -11,27 +11,25 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file class tdf135693(UITestCase): def test_tdf135693(self): - writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf135693.odt")) + with self.ui_test.load_file(get_url_for_data_file("tdf135693.odt")) as writer_doc: - self.xUITest.getTopFocusWindow() + self.xUITest.getTopFocusWindow() - self.xUITest.executeCommand(".uno:GoRight") - self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoRight") + self.xUITest.executeCommand(".uno:GoDown") - # Without the fix in place, this would have crashed here - self.ui_test.execute_dialog_through_command(".uno:TableDialog") + # Without the fix in place, this would have crashed here + self.ui_test.execute_dialog_through_command(".uno:TableDialog") - xTableDlg = self.xUITest.getTopFocusWindow() + xTableDlg = self.xUITest.getTopFocusWindow() - xTabs = xTableDlg.getChild("tabcontrol") - select_pos(xTabs, "0") + xTabs = xTableDlg.getChild("tabcontrol") + select_pos(xTabs, "0") - # Check we are in the right table - self.assertEqual("Table1", get_state_as_dict(xTabs.getChild('name'))['Text']) + # Check we are in the right table + self.assertEqual("Table1", get_state_as_dict(xTabs.getChild('name'))['Text']) - xok = xTableDlg.getChild("ok") - self.ui_test.close_dialog_through_button(xok) - - self.ui_test.close_doc() + xok = xTableDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xok) # vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/table/tdf81292.py b/sw/qa/uitest/table/tdf81292.py index 343b1a89bb13..50996861d6ac 100644 --- a/sw/qa/uitest/table/tdf81292.py +++ b/sw/qa/uitest/table/tdf81292.py @@ -12,30 +12,29 @@ from uitest.uihelper.common import get_url_for_data_file 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") + with self.ui_test.load_file(get_url_for_data_file("tdf81292.odt")) as writer_doc: + 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 index e87226a0c485..9e1b649becbe 100644 --- a/sw/qa/uitest/table/tdf99334.py +++ b/sw/qa/uitest/table/tdf99334.py @@ -12,28 +12,27 @@ from uitest.uihelper.common import get_url_for_data_file 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") + with self.ui_test.load_file(get_url_for_data_file("tdf99334.odt")) as writer_doc: + 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 index d901ae6d2c04..2b820b360653 100644 --- a/sw/qa/uitest/table/textToTable.py +++ b/sw/qa/uitest/table/textToTable.py @@ -38,33 +38,32 @@ class textToTable(UITestCase): 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") + with self.ui_test.load_file(get_url_for_data_file("textToTable.odt")) as writer_doc: + 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: |