180a6f5c5SLiu Zhe package fvt.gui.sw.table; 2ca72bc94SLiu Zhe 3ca72bc94SLiu Zhe import static org.junit.Assert.*; 4ca72bc94SLiu Zhe import static org.openoffice.test.vcl.Tester.*; 5b4d2d410SLiu Zhe import static testlib.gui.AppTool.*; 6ca72bc94SLiu Zhe import static testlib.gui.UIMap.*; 7ca72bc94SLiu Zhe 8ca72bc94SLiu Zhe import org.junit.After; 9ca72bc94SLiu Zhe import org.junit.Before; 10ca72bc94SLiu Zhe import org.junit.Ignore; 11ca72bc94SLiu Zhe import org.junit.Rule; 12ca72bc94SLiu Zhe import org.junit.Test; 13ca72bc94SLiu Zhe import org.openoffice.test.common.Logger; 14ca72bc94SLiu Zhe import org.openoffice.test.common.SystemUtil; 15ca72bc94SLiu Zhe 16ca72bc94SLiu Zhe 17ca72bc94SLiu Zhe public class TableGeneral { 18ca72bc94SLiu Zhe 19ca72bc94SLiu Zhe @Rule 20ca72bc94SLiu Zhe public Logger log = Logger.getLogger(this); 21ca72bc94SLiu Zhe 22ca72bc94SLiu Zhe @Before 23ca72bc94SLiu Zhe public void setUp() throws Exception { 24ca72bc94SLiu Zhe // Start OpenOffice 25ca72bc94SLiu Zhe app.start(); 26ca72bc94SLiu Zhe 27ca72bc94SLiu Zhe // Create a new text document 28ca72bc94SLiu Zhe app.dispatch("private:factory/swriter"); 29ca72bc94SLiu Zhe 30ca72bc94SLiu Zhe // Insert a table 31ca72bc94SLiu Zhe app.dispatch(".uno:InsertTable"); 32b4d2d410SLiu Zhe assertTrue("Insert Table dialog pop up", writerInsertTable.exists()); 33ca72bc94SLiu Zhe } 34ca72bc94SLiu Zhe 35ca72bc94SLiu Zhe @After 36ca72bc94SLiu Zhe public void tearDown() throws Exception { 37ca72bc94SLiu Zhe app.close(); 38ca72bc94SLiu Zhe } 39ca72bc94SLiu Zhe 40ca72bc94SLiu Zhe @Test 41ca72bc94SLiu Zhe // Test setting table size in text document 42ca72bc94SLiu Zhe public void testTableSize() throws Exception { 43ca72bc94SLiu Zhe 44b4d2d410SLiu Zhe swTableSizeColBox.focus(); 45ca72bc94SLiu Zhe typeKeys("<delete>"); 46ca72bc94SLiu Zhe typeKeys("3"); 47b4d2d410SLiu Zhe swTableSizeRowBox.focus(); 48ca72bc94SLiu Zhe typeKeys("<delete>"); 49ca72bc94SLiu Zhe typeKeys("4"); 50b4d2d410SLiu Zhe writerInsertTable.ok(); 51ca72bc94SLiu Zhe 52ca72bc94SLiu Zhe writer.focus(); // verify how many rows in the table 53b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 54ca72bc94SLiu Zhe for (int i = 0; i < 3; i++) { 55ca72bc94SLiu Zhe typeKeys("<down>"); 56b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 57ca72bc94SLiu Zhe } 58ca72bc94SLiu Zhe typeKeys("<down>"); 59ca72bc94SLiu Zhe sleep(1); 60b4d2d410SLiu Zhe assertFalse(tableToolbar.exists()); 61ca72bc94SLiu Zhe } 62ca72bc94SLiu Zhe 63ca72bc94SLiu Zhe // Test setting table cell background in text document 64ca72bc94SLiu Zhe 65ca72bc94SLiu Zhe @Test 66*83ae2205SHerbert Dürr @Ignore("Bug #120378") 67ca72bc94SLiu Zhe public void testTableBackground() throws Exception { 68b4d2d410SLiu Zhe writerInsertTable.ok(); 69b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 70ca72bc94SLiu Zhe writer.focus(); 71ca72bc94SLiu Zhe // set table cell background 72ca72bc94SLiu Zhe app.dispatch(".uno:TableDialog"); 73b4d2d410SLiu Zhe swTableBackground.select(); 74ca72bc94SLiu Zhe assertTrue("Table background property dialog pop up", 75b4d2d410SLiu Zhe swTableBackground.exists()); 76ca72bc94SLiu Zhe ; 77b4d2d410SLiu Zhe swTableBackgroundColor.focus(); 78b4d2d410SLiu Zhe swTableBackgroundColor.click(50, 50); 79b4d2d410SLiu Zhe swTableBackground.ok(); 80ca72bc94SLiu Zhe // verify table cell background color 81ca72bc94SLiu Zhe writer.focus(); 82ca72bc94SLiu Zhe // select the cell which is filled with color 83ca72bc94SLiu Zhe app.dispatch(".uno:EntireCell"); 84ca72bc94SLiu Zhe 85ca72bc94SLiu Zhe typeKeys("<ctrl c>"); 86ca72bc94SLiu Zhe app.dispatch("private:factory/simpress?slot=6686"); 87b4d2d410SLiu Zhe presentationWizard.ok(); 88ca72bc94SLiu Zhe typeKeys("<ctrl v>"); 89ca72bc94SLiu Zhe // enable table cell area format dialog 90ca72bc94SLiu Zhe app.dispatch(".uno:FormatArea"); 91ca72bc94SLiu Zhe sleep(1); 92b4d2d410SLiu Zhe assertEquals("Light red", sdTableBACGColorListbox.getSelText()); 93ca72bc94SLiu Zhe // close table cell area format dialog 94b4d2d410SLiu Zhe sdTableBACGColorArea.cancel(); 95ca72bc94SLiu Zhe } 96ca72bc94SLiu Zhe 97ca72bc94SLiu Zhe // Test setting table border in text document 98ca72bc94SLiu Zhe 99ca72bc94SLiu Zhe @Test 100ca72bc94SLiu Zhe public void testTableBorder() throws Exception { 101b4d2d410SLiu Zhe writerInsertTable.ok(); 102b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 103ca72bc94SLiu Zhe // set table border as none 104ca72bc94SLiu Zhe writer.focus(); 105ca72bc94SLiu Zhe app.dispatch(".uno:TableDialog"); 106b4d2d410SLiu Zhe swTableBorder.select(); 107ca72bc94SLiu Zhe assertTrue("Table border property dialog pop up", 108b4d2d410SLiu Zhe swTableBorder.exists()); 109ca72bc94SLiu Zhe ; 110b4d2d410SLiu Zhe swTableBorderLineArrange.click(10, 10); 111b4d2d410SLiu Zhe swTableBorder.ok(); 112ca72bc94SLiu Zhe } 113ca72bc94SLiu Zhe 114ca72bc94SLiu Zhe // Test setting table border line style,line color,spacing to content in 115ca72bc94SLiu Zhe // text document 116ca72bc94SLiu Zhe 117ca72bc94SLiu Zhe @Test 118ca72bc94SLiu Zhe public void testTableBorderLineStyle() throws Exception { 119b4d2d410SLiu Zhe writerInsertTable.ok(); 120b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 121ca72bc94SLiu Zhe writer.focus(); 122ca72bc94SLiu Zhe app.dispatch(".uno:TableDialog"); 123b4d2d410SLiu Zhe swTableBorder.select(); 124ca72bc94SLiu Zhe assertTrue("Table border property dialog pop up", 125b4d2d410SLiu Zhe swTableBorder.exists()); 126ca72bc94SLiu Zhe ; 127b4d2d410SLiu Zhe swTableBorderLineStyle.select(8); // set line style 128b4d2d410SLiu Zhe swTableBorderLineColor.select(5); // set line color 129b4d2d410SLiu Zhe swTableSTCLeft.focus(); // set spacing to content 130ca72bc94SLiu Zhe typeKeys("<ctrl a>"); 131ca72bc94SLiu Zhe typeKeys("<delete>"); 132ca72bc94SLiu Zhe typeKeys("0.5"); // set spacing to content 133b4d2d410SLiu Zhe swTableShadow.click(40, 10); // set table shadow 134b4d2d410SLiu Zhe swTableShadowSize.focus(); 135ca72bc94SLiu Zhe typeKeys("<ctrl a>"); 136ca72bc94SLiu Zhe typeKeys("<delete>"); 137ca72bc94SLiu Zhe typeKeys("2"); 138b4d2d410SLiu Zhe swTableShadowColor.select(5); 139b4d2d410SLiu Zhe swTableBorder.ok(); 140ca72bc94SLiu Zhe 141ca72bc94SLiu Zhe writer.focus(); // verify the setting property of table 142ca72bc94SLiu Zhe app.dispatch(".uno:TableDialog"); 143b4d2d410SLiu Zhe swTableBorder.select(); 144b4d2d410SLiu Zhe assertEquals("2.60 pt", swTableBorderLineStyle.getItemText(8)); 145b4d2d410SLiu Zhe assertEquals("Magenta", swTableBorderLineColor.getItemText(5)); 146b4d2d410SLiu Zhe assertEquals("0.50\"", swTableSTCLeft.getText()); 147b4d2d410SLiu Zhe assertEquals("0.50\"", swTableSTCRight.getText()); 148b4d2d410SLiu Zhe assertEquals("0.50\"", swTableSTCTop.getText()); 149b4d2d410SLiu Zhe assertEquals("0.50\"", swTableSTCBottom.getText()); 150b4d2d410SLiu Zhe assertEquals("1.97\"", swTableShadowSize.getText()); 151b4d2d410SLiu Zhe assertEquals("Magenta", swTableShadowColor.getItemText(5)); 152b4d2d410SLiu Zhe assertTrue("SWTableSTC_SYNC", swTableSTCSYNC.isChecked()); 153b4d2d410SLiu Zhe swTableBorder.close(); 154ca72bc94SLiu Zhe 155ca72bc94SLiu Zhe // uncheck Synchronize box and set spacing to content 156ca72bc94SLiu Zhe 157ca72bc94SLiu Zhe writer.focus(); 158ca72bc94SLiu Zhe app.dispatch(".uno:TableDialog"); 159b4d2d410SLiu Zhe swTableBorder.select(); 160b4d2d410SLiu Zhe swTableSTCSYNC.uncheck(); 161b4d2d410SLiu Zhe swTableSTCLeft.focus();// set left spacing to content 162ca72bc94SLiu Zhe typeKeys("<ctrl a>"); 163ca72bc94SLiu Zhe typeKeys("<delete>"); 164ca72bc94SLiu Zhe typeKeys("0.5"); 165b4d2d410SLiu Zhe swTableSTCRight.focus();// set right spacing to content 166ca72bc94SLiu Zhe typeKeys("<ctrl a>"); 167ca72bc94SLiu Zhe typeKeys("<delete>"); 168ca72bc94SLiu Zhe typeKeys("0.8"); 169b4d2d410SLiu Zhe swTableSTCTop.focus();// set top spacing to content 170ca72bc94SLiu Zhe typeKeys("<ctrl a>"); 171ca72bc94SLiu Zhe typeKeys("<delete>"); 172ca72bc94SLiu Zhe typeKeys("1.0"); 173b4d2d410SLiu Zhe swTableSTCBottom.focus();// set bottom spacing to content 174ca72bc94SLiu Zhe typeKeys("<ctrl a>"); 175ca72bc94SLiu Zhe typeKeys("<delete>"); 176ca72bc94SLiu Zhe typeKeys("2"); 177b4d2d410SLiu Zhe swTableBorder.ok(); 178b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 179ca72bc94SLiu Zhe 180ca72bc94SLiu Zhe writer.focus(); // verify the setting value of spacing to content for 181ca72bc94SLiu Zhe // tabel 182ca72bc94SLiu Zhe app.dispatch(".uno:TableDialog"); 183b4d2d410SLiu Zhe swTableBorder.select(); 184b4d2d410SLiu Zhe assertEquals("0.50\"", swTableSTCLeft.getText()); 185b4d2d410SLiu Zhe assertEquals("0.80\"", swTableSTCRight.getText()); 186b4d2d410SLiu Zhe assertEquals("1.00\"", swTableSTCTop.getText()); 187b4d2d410SLiu Zhe assertEquals("1.97\"", swTableSTCBottom.getText()); 188b4d2d410SLiu Zhe assertFalse("SWTableSTC_SYNC", swTableSTCSYNC.isChecked()); 189b4d2d410SLiu Zhe swTableBorder.close(); 190ca72bc94SLiu Zhe } 191ca72bc94SLiu Zhe 192ca72bc94SLiu Zhe // create table with auto format 193ca72bc94SLiu Zhe 194ca72bc94SLiu Zhe @Test 195ca72bc94SLiu Zhe public void testTableAutoFormat() throws Exception { 196ca72bc94SLiu Zhe // create table with auto format 197ca72bc94SLiu Zhe button("sw:PushButton:DLG_INSERT_TABLE:BT_AUTOFORMAT").click(); 198b4d2d410SLiu Zhe assertTrue("Table auto format dialog pop up", swTableAutoFMT.exists()); 199b4d2d410SLiu Zhe swTableAutoFormatListbox.select(3); 200b4d2d410SLiu Zhe swTableAutoFMT.ok(); 201ca72bc94SLiu Zhe // verify the auto format is that just selected 202ca72bc94SLiu Zhe button("sw:PushButton:DLG_INSERT_TABLE:BT_AUTOFORMAT").click(); 203b4d2d410SLiu Zhe assertEquals("Blue", swTableAutoFormatListbox.getSelText()); 204b4d2d410SLiu Zhe swTableAutoFMT.close(); 205b4d2d410SLiu Zhe writerInsertTable.ok(); 206b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 207ca72bc94SLiu Zhe 208ca72bc94SLiu Zhe } 209ca72bc94SLiu Zhe 210ca72bc94SLiu Zhe // set row height and select row,insert/delete row 211ca72bc94SLiu Zhe 212ca72bc94SLiu Zhe @Test 213ca72bc94SLiu Zhe public void testTableRowHeight() throws Exception { 214b4d2d410SLiu Zhe writerInsertTable.ok(); 215b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 216ca72bc94SLiu Zhe 217ca72bc94SLiu Zhe // set row height 218ca72bc94SLiu Zhe writer.focus(); 219ca72bc94SLiu Zhe writer.openContextMenu(); 220b4d2d410SLiu Zhe swTableRowHeightMenu.select(); 221b4d2d410SLiu Zhe assertTrue(swTableSetRowHeightDialog.exists()); 222b4d2d410SLiu Zhe swTableSetRowHeight.focus(); 223ca72bc94SLiu Zhe typeKeys("<ctrl a>"); 224ca72bc94SLiu Zhe typeKeys("<delete>"); 225ca72bc94SLiu Zhe typeKeys("0.5"); 226b4d2d410SLiu Zhe swTableSetRowHeightDialog.ok(); 227ca72bc94SLiu Zhe 228ca72bc94SLiu Zhe // verify row height 229ca72bc94SLiu Zhe writer.focus(); 230ca72bc94SLiu Zhe writer.openContextMenu(); 231b4d2d410SLiu Zhe swTableRowHeightMenu.select(); 232b4d2d410SLiu Zhe assertTrue(swTableSetRowHeightDialog.exists()); 233b4d2d410SLiu Zhe assertEquals("0.50\"", swTableSetRowHeight.getText()); 234b4d2d410SLiu Zhe swTableSetRowHeightDialog.close(); 235ca72bc94SLiu Zhe } 236ca72bc94SLiu Zhe 237ca72bc94SLiu Zhe // select row 238ca72bc94SLiu Zhe @Test 239ca72bc94SLiu Zhe public void testTableSelectRow() throws Exception { 240b4d2d410SLiu Zhe writerInsertTable.ok(); 241b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 242ca72bc94SLiu Zhe // select row 243ca72bc94SLiu Zhe writer.focus(); 244ca72bc94SLiu Zhe writer.openContextMenu(); 245b4d2d410SLiu Zhe swTableSelectRowMenu.select(); 246ca72bc94SLiu Zhe 247ca72bc94SLiu Zhe // verify select one row successfully 248ca72bc94SLiu Zhe typeKeys("<ctrl c>"); 249ca72bc94SLiu Zhe typeKeys("<down>"); 250ca72bc94SLiu Zhe typeKeys("<down>"); 251ca72bc94SLiu Zhe typeKeys("<enter>"); 252ca72bc94SLiu Zhe typeKeys("<ctrl v>"); 253ca72bc94SLiu Zhe typeKeys("<up>"); 254b4d2d410SLiu Zhe assertTrue(tableToolbar.exists()); 255ca72bc94SLiu Zhe 256ca72bc94SLiu Zhe } 257ca72bc94SLiu Zhe 258ca72bc94SLiu Zhe // insert row and verify how many row inserted 259ca72bc94SLiu Zhe @Test 260ca72bc94SLiu Zhe public void testTableInsertRow() throws Exception { 261b4d2d410SLiu Zhe writerInsertTable.ok(); 262b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 263ca72bc94SLiu Zhe writer.focus(); 264ca72bc94SLiu Zhe writer.openContextMenu(); 265b4d2d410SLiu Zhe swTableInsertRowMenu.select(); 266ca72bc94SLiu Zhe assertTrue("SWTable_InsertRow Dialog pop up", 267b4d2d410SLiu Zhe swTableInsertRow.exists()); 268b4d2d410SLiu Zhe swTableInsertRowColumnSetNumber.focus(); 269ca72bc94SLiu Zhe typeKeys("<ctrl a>"); 270ca72bc94SLiu Zhe typeKeys("<delete>"); 271ca72bc94SLiu Zhe typeKeys("3"); 272b4d2d410SLiu Zhe swTableInsertRow.ok(); 273ca72bc94SLiu Zhe 274ca72bc94SLiu Zhe writer.focus(); // verify how many rows in the table 275b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 276ca72bc94SLiu Zhe for (int i = 0; i < 4; i++) { 277ca72bc94SLiu Zhe typeKeys("<down>"); 278b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 279ca72bc94SLiu Zhe } 280ca72bc94SLiu Zhe typeKeys("<down>"); 281ca72bc94SLiu Zhe sleep(1); 282b4d2d410SLiu Zhe assertFalse(tableToolbar.exists()); 283ca72bc94SLiu Zhe } 284ca72bc94SLiu Zhe 285ca72bc94SLiu Zhe // delete row and verify row 286ca72bc94SLiu Zhe @Test 287ca72bc94SLiu Zhe public void testTableRowDelete() throws Exception { 288b4d2d410SLiu Zhe writerInsertTable.ok(); 289b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 290ca72bc94SLiu Zhe // delete row 291ca72bc94SLiu Zhe writer.focus(); 292ca72bc94SLiu Zhe writer.openContextMenu(); 293b4d2d410SLiu Zhe swTableRowDleteMenu.select(); 294ca72bc94SLiu Zhe // verify whether delete row 295ca72bc94SLiu Zhe writer.focus(); 296b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 297ca72bc94SLiu Zhe typeKeys("<down>"); 298ca72bc94SLiu Zhe sleep(1); 299b4d2d410SLiu Zhe assertFalse(tableToolbar.exists()); 300ca72bc94SLiu Zhe 301ca72bc94SLiu Zhe } 302ca72bc94SLiu Zhe 303ca72bc94SLiu Zhe // set column width and verify 304ca72bc94SLiu Zhe @Test 305ca72bc94SLiu Zhe public void testTableColumnWidth() throws Exception { 306b4d2d410SLiu Zhe writerInsertTable.ok(); 307b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 308ca72bc94SLiu Zhe // set column width 309ca72bc94SLiu Zhe writer.focus(); 310ca72bc94SLiu Zhe writer.openContextMenu(); 311b4d2d410SLiu Zhe swTableColumnWidthMenu.select(); 312b4d2d410SLiu Zhe swTableSetColumnWidth.focus(); 313ca72bc94SLiu Zhe typeKeys("<ctrl a>"); 314ca72bc94SLiu Zhe typeKeys("<delete>"); 315ca72bc94SLiu Zhe typeKeys("2"); 316b4d2d410SLiu Zhe swTableSetColumnDialog.ok(); 317ca72bc94SLiu Zhe // verify column width 318ca72bc94SLiu Zhe writer.focus(); 319ca72bc94SLiu Zhe writer.openContextMenu(); 320b4d2d410SLiu Zhe swTableColumnWidthMenu.select(); 321b4d2d410SLiu Zhe assertEquals("2.00\"", swTableSetColumnWidth.getText()); 322ca72bc94SLiu Zhe 323ca72bc94SLiu Zhe } 324ca72bc94SLiu Zhe 325ca72bc94SLiu Zhe // select column and verify 326ca72bc94SLiu Zhe @Test 327ca72bc94SLiu Zhe public void testTableColumnSelect() throws Exception { 328b4d2d410SLiu Zhe writerInsertTable.ok(); 329b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 330ca72bc94SLiu Zhe writer.focus(); 331ca72bc94SLiu Zhe writer.openContextMenu(); 332b4d2d410SLiu Zhe swTableColumnSelectMenu.select(); 333ca72bc94SLiu Zhe 334ca72bc94SLiu Zhe // verify select one column 335ca72bc94SLiu Zhe typeKeys("<ctrl c>"); 336ca72bc94SLiu Zhe typeKeys("<down>"); 337ca72bc94SLiu Zhe typeKeys("<down>"); 338ca72bc94SLiu Zhe typeKeys("<enter>"); 339ca72bc94SLiu Zhe typeKeys("<ctrl v>"); 340ca72bc94SLiu Zhe typeKeys("<up>"); 341b4d2d410SLiu Zhe assertTrue(tableToolbar.exists()); 342ca72bc94SLiu Zhe 343ca72bc94SLiu Zhe } 344ca72bc94SLiu Zhe 345ca72bc94SLiu Zhe // insert column and verify 346ca72bc94SLiu Zhe @Test 347ca72bc94SLiu Zhe public void testTableColumnInsert() throws Exception { 348b4d2d410SLiu Zhe writerInsertTable.ok(); 349b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 350ca72bc94SLiu Zhe // insert column 351ca72bc94SLiu Zhe writer.focus(); 352ca72bc94SLiu Zhe writer.openContextMenu(); 353b4d2d410SLiu Zhe swTableColumnInsertMenu.select(); 354b4d2d410SLiu Zhe swTableInsertRowColumnSetNumber.focus(); 355ca72bc94SLiu Zhe typeKeys("<ctrl a>"); 356ca72bc94SLiu Zhe typeKeys("<delete>"); 357ca72bc94SLiu Zhe typeKeys("3"); 358b4d2d410SLiu Zhe swTableInsertColumn.ok(); 359ca72bc94SLiu Zhe // verify insert column successfully 360ca72bc94SLiu Zhe writer.focus(); 361b4d2d410SLiu Zhe assertTrue(tableToolbar.exists()); 362ca72bc94SLiu Zhe for (int i = 0; i < 9; i++) { 363ca72bc94SLiu Zhe typeKeys("<right>"); 364ca72bc94SLiu Zhe sleep(1); 365b4d2d410SLiu Zhe assertTrue(tableToolbar.exists()); 366ca72bc94SLiu Zhe } 367ca72bc94SLiu Zhe typeKeys("<right>"); 368ca72bc94SLiu Zhe sleep(1); 369b4d2d410SLiu Zhe assertFalse(tableToolbar.exists()); 370ca72bc94SLiu Zhe } 371ca72bc94SLiu Zhe 372ca72bc94SLiu Zhe // delete column and verify whether delete or not 373ca72bc94SLiu Zhe public void testTableColumnDelete() throws Exception { 374b4d2d410SLiu Zhe writerInsertTable.ok(); 375b4d2d410SLiu Zhe assertNotNull(statusBar.getItemTextById(8)); 376ca72bc94SLiu Zhe // delete column 377ca72bc94SLiu Zhe writer.focus(); 378ca72bc94SLiu Zhe writer.openContextMenu(); 379b4d2d410SLiu Zhe swTableColumnDeleteMenu.select(); 380ca72bc94SLiu Zhe // verify delete column 381ca72bc94SLiu Zhe writer.focus(); 382b4d2d410SLiu Zhe assertTrue(tableToolbar.exists()); 383ca72bc94SLiu Zhe for (int i = 0; i < 7; i++) { 384ca72bc94SLiu Zhe typeKeys("<right>"); 385b4d2d410SLiu Zhe assertTrue(tableToolbar.exists()); 386ca72bc94SLiu Zhe } 387ca72bc94SLiu Zhe sleep(1); 388b4d2d410SLiu Zhe assertFalse(tableToolbar.exists()); 389ca72bc94SLiu Zhe } 390ca72bc94SLiu Zhe 391ca72bc94SLiu Zhe // split cell 392ca72bc94SLiu Zhe @Test 393ca72bc94SLiu Zhe public void testTableCellSplit() throws Exception { 394b4d2d410SLiu Zhe writerInsertTable.ok(); 395b4d2d410SLiu Zhe assertTrue(tableToolbar.exists()); 396ca72bc94SLiu Zhe for (int k = 0; k < 2; k++) { 397ca72bc94SLiu Zhe writer.focus(); 398ca72bc94SLiu Zhe writer.openContextMenu(); 399b4d2d410SLiu Zhe swTableCellSplitMenu.select(); 400b4d2d410SLiu Zhe swTableCellSplitNumber.focus(); 401ca72bc94SLiu Zhe typeKeys("<ctrl a>"); 402ca72bc94SLiu Zhe typeKeys("<delete>"); 403ca72bc94SLiu Zhe typeKeys("2"); 404ca72bc94SLiu Zhe if (k == 0) { 405b4d2d410SLiu Zhe swTableCellSplitDialog.ok(); // split table cell horizontally 406ca72bc94SLiu Zhe } else { 407b4d2d410SLiu Zhe swTableCellSplitVERTButton.check(); // split table cell 408ca72bc94SLiu Zhe // vertically 409b4d2d410SLiu Zhe swTableCellSplitDialog.ok(); 410ca72bc94SLiu Zhe } 411ca72bc94SLiu Zhe } 412ca72bc94SLiu Zhe // verify cell split successfully 413ca72bc94SLiu Zhe writer.focus(); 414b4d2d410SLiu Zhe assertTrue(tableToolbar.exists()); 415ca72bc94SLiu Zhe for (int i = 0; i < 7; i++) { 416ca72bc94SLiu Zhe typeKeys("<right>"); 417b4d2d410SLiu Zhe assertTrue(tableToolbar.exists()); 418ca72bc94SLiu Zhe } 419ca72bc94SLiu Zhe sleep(1); 420b4d2d410SLiu Zhe assertFalse(tableToolbar.exists()); 421ca72bc94SLiu Zhe } 422ca72bc94SLiu Zhe 423ca72bc94SLiu Zhe /** 424ca72bc94SLiu Zhe * Test convert table to text in text document 425ca72bc94SLiu Zhe * 426ca72bc94SLiu Zhe * @throws Exception 427ca72bc94SLiu Zhe */ 428ca72bc94SLiu Zhe @Test 429ca72bc94SLiu Zhe public void testConvertTableToText() throws Exception { 430b4d2d410SLiu Zhe writerInsertTable.ok(); 431ca72bc94SLiu Zhe writer.focus(); 432ca72bc94SLiu Zhe typeKeys("1<right>2<right>3<right>4"); 433ca72bc94SLiu Zhe sleep(1); 434ca72bc94SLiu Zhe 435ca72bc94SLiu Zhe // Convert table to text 436ca72bc94SLiu Zhe app.dispatch(".uno:ConvertTableToText"); 437b4d2d410SLiu Zhe assertTrue("Convert Table to Text dialog pop up", writerConvertTableToTextDlg.exists()); 438ca72bc94SLiu Zhe // typeKeys("<enter>"); 439b4d2d410SLiu Zhe writerConvertTableToTextDlg.ok(); // "Enter" does not work on linux 440ca72bc94SLiu Zhe 441ca72bc94SLiu Zhe // Verify if text is converted successfully 442ca72bc94SLiu Zhe app.dispatch(".uno:SelectAll"); 443ca72bc94SLiu Zhe app.dispatch(".uno:Copy"); 444ca72bc94SLiu Zhe if (SystemUtil.isWindows()) 445ca72bc94SLiu Zhe assertEquals("Converted text", "1\t2\r\n3\t4\r\n", app.getClipboard()); // in 446ca72bc94SLiu Zhe // windows, 447ca72bc94SLiu Zhe // \n 448ca72bc94SLiu Zhe // is 449ca72bc94SLiu Zhe // \r\n 450ca72bc94SLiu Zhe else 451ca72bc94SLiu Zhe assertEquals("Converted text", "1\t2\n3\t4\n", app.getClipboard()); 452ca72bc94SLiu Zhe } 453*83ae2205SHerbert Dürr } 454