incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liu...@apache.org
Subject svn commit: r1379259 - in /incubator/ooo/trunk/test/testgui/source: testcase/gui/sw/table/Table.java testcase/gui/sw/table/TableGeneral.java testlib/gui/UIMap.java
Date Fri, 31 Aug 2012 02:27:34 GMT
Author: liuzhe
Date: Fri Aug 31 02:27:34 2012
New Revision: 1379259

URL: http://svn.apache.org/viewvc?rev=1379259&view=rev
Log:
#120343 - GUI Automation Script:writing test script about table general function in word processor
Patch By: Du Jing <bjdujing@gmail.com>
Review By: Liu Zhe <aliuzhe@gmail.com>

Added:
    incubator/ooo/trunk/test/testgui/source/testcase/gui/sw/table/TableGeneral.java
Removed:
    incubator/ooo/trunk/test/testgui/source/testcase/gui/sw/table/Table.java
Modified:
    incubator/ooo/trunk/test/testgui/source/testlib/gui/UIMap.java

Added: incubator/ooo/trunk/test/testgui/source/testcase/gui/sw/table/TableGeneral.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testgui/source/testcase/gui/sw/table/TableGeneral.java?rev=1379259&view=auto
==============================================================================
--- incubator/ooo/trunk/test/testgui/source/testcase/gui/sw/table/TableGeneral.java (added)
+++ incubator/ooo/trunk/test/testgui/source/testcase/gui/sw/table/TableGeneral.java Fri Aug
31 02:27:34 2012
@@ -0,0 +1,454 @@
+package testcase.gui.sw.table;
+
+import static org.junit.Assert.*;
+import static org.openoffice.test.vcl.Tester.*;
+import static testlib.gui.AppUtil.*;
+import static testlib.gui.UIMap.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.openoffice.test.common.Logger;
+import org.openoffice.test.common.SystemUtil;
+
+
+public class TableGeneral {
+
+	@Rule
+	public Logger log = Logger.getLogger(this);
+
+	@Before
+	public void setUp() throws Exception {
+		// Start OpenOffice
+		app.start();
+
+		// Create a new text document
+		app.dispatch("private:factory/swriter");
+
+		// Insert a table
+		app.dispatch(".uno:InsertTable");
+		assertTrue("Insert Table dialog pop up", writer_InsertTable.exists());
+	}
+
+	@After
+	public void tearDown() throws Exception {
+		app.close();
+	}
+
+	@Test
+	// Test setting table size in text document
+	public void testTableSize() throws Exception {
+
+		SWTableSizeColBox.focus();
+		typeKeys("<delete>");
+		typeKeys("3");
+		SWTableSizeRowBox.focus();
+		typeKeys("<delete>");
+		typeKeys("4");
+		writer_InsertTable.ok();
+
+		writer.focus(); // verify how many rows in the table
+		assertNotNull(StatusBar.getItemTextById(8));
+		for (int i = 0; i < 3; i++) {
+			typeKeys("<down>");
+			assertNotNull(StatusBar.getItemTextById(8));
+		}
+		typeKeys("<down>");
+		sleep(1);
+		assertFalse(Table_Toolbar.exists());
+	}
+
+	// Test setting table cell background in text document
+
+	@Test
+	@Ignore
+	// bug120378
+	public void testTableBackground() throws Exception {
+		writer_InsertTable.ok();
+		assertNotNull(StatusBar.getItemTextById(8));
+		writer.focus();
+		// set table cell background
+		app.dispatch(".uno:TableDialog");
+		SWTableBackground.select();
+		assertTrue("Table background property dialog pop up",
+				SWTableBackground.exists());
+		;
+		SWTableBackgroundColor.focus();
+		SWTableBackgroundColor.click(50, 50);
+		SWTableBackground.ok();
+		// verify table cell background color
+		writer.focus();
+		// select the cell which is filled with color
+		app.dispatch(".uno:EntireCell");
+
+		typeKeys("<ctrl c>");
+		app.dispatch("private:factory/simpress?slot=6686");
+		PresentationWizard.ok();
+		typeKeys("<ctrl v>");
+		// enable table cell area format dialog
+		app.dispatch(".uno:FormatArea");
+		sleep(1);
+		assertEquals("Light red", SDTable_BACGColorListbox.getSelText());
+		// close table cell area format dialog
+		SDTable_BACGColorArea.cancel();
+	}
+
+	// Test setting table border in text document
+
+	@Test
+	public void testTableBorder() throws Exception {
+		writer_InsertTable.ok();
+		assertNotNull(StatusBar.getItemTextById(8));
+		// set table border as none
+		writer.focus();
+		app.dispatch(".uno:TableDialog");
+		SWTableBorder.select();
+		assertTrue("Table border property dialog pop up",
+				SWTableBorder.exists());
+		;
+		SWTableBorderLineArrange.click(10, 10);
+		SWTableBorder.ok();
+	}
+
+	// Test setting table border line style,line color,spacing to content in
+	// text document
+
+	@Test
+	public void testTableBorderLineStyle() throws Exception {
+		writer_InsertTable.ok();
+		assertNotNull(StatusBar.getItemTextById(8));
+		writer.focus();
+		app.dispatch(".uno:TableDialog");
+		SWTableBorder.select();
+		assertTrue("Table border property dialog pop up",
+				SWTableBorder.exists());
+		;
+		SWTableBorderLineStyle.select(8); // set line style
+		SWTableBorderLineColor.select(5); // set line color
+		SWTableSTCLeft.focus(); // set spacing to content
+		typeKeys("<ctrl a>");
+		typeKeys("<delete>");
+		typeKeys("0.5"); // set spacing to content
+		SWTableShadow.click(40, 10); // set table shadow
+		SWTableShadowSize.focus();
+		typeKeys("<ctrl a>");
+		typeKeys("<delete>");
+		typeKeys("2");
+		SWTableShadowColor.select(5);
+		SWTableBorder.ok();
+
+		writer.focus(); // verify the setting property of table
+		app.dispatch(".uno:TableDialog");
+		SWTableBorder.select();
+		assertEquals("2.60 pt", SWTableBorderLineStyle.getItemText(8));
+		assertEquals("Magenta", SWTableBorderLineColor.getItemText(5));
+		assertEquals("0.50\"", SWTableSTCLeft.getText());
+		assertEquals("0.50\"", SWTableSTCRight.getText());
+		assertEquals("0.50\"", SWTableSTCTop.getText());
+		assertEquals("0.50\"", SWTableSTCBottom.getText());
+		assertEquals("1.97\"", SWTableShadowSize.getText());
+		assertEquals("Magenta", SWTableShadowColor.getItemText(5));
+		assertTrue("SWTableSTC_SYNC", SWTableSTC_SYNC.isChecked());
+		SWTableBorder.close();
+
+		// uncheck Synchronize box and set spacing to content
+
+		writer.focus();
+		app.dispatch(".uno:TableDialog");
+		SWTableBorder.select();
+		SWTableSTC_SYNC.uncheck();
+		SWTableSTCLeft.focus();// set left spacing to content
+		typeKeys("<ctrl a>");
+		typeKeys("<delete>");
+		typeKeys("0.5");
+		SWTableSTCRight.focus();// set right spacing to content
+		typeKeys("<ctrl a>");
+		typeKeys("<delete>");
+		typeKeys("0.8");
+		SWTableSTCTop.focus();// set top spacing to content
+		typeKeys("<ctrl a>");
+		typeKeys("<delete>");
+		typeKeys("1.0");
+		SWTableSTCBottom.focus();// set bottom spacing to content
+		typeKeys("<ctrl a>");
+		typeKeys("<delete>");
+		typeKeys("2");
+		SWTableBorder.ok();
+		assertNotNull(StatusBar.getItemTextById(8));
+
+		writer.focus(); // verify the setting value of spacing to content for
+						// tabel
+		app.dispatch(".uno:TableDialog");
+		SWTableBorder.select();
+		assertEquals("0.50\"", SWTableSTCLeft.getText());
+		assertEquals("0.80\"", SWTableSTCRight.getText());
+		assertEquals("1.00\"", SWTableSTCTop.getText());
+		assertEquals("1.97\"", SWTableSTCBottom.getText());
+		assertFalse("SWTableSTC_SYNC", SWTableSTC_SYNC.isChecked());
+		SWTableBorder.close();
+	}
+
+	// create table with auto format
+
+	@Test
+	public void testTableAutoFormat() throws Exception {
+		// create table with auto format
+		button("sw:PushButton:DLG_INSERT_TABLE:BT_AUTOFORMAT").click();
+		assertTrue("Table auto format dialog pop up", SWTableAutoFMT.exists());
+		SWTableAutoFormat_Listbox.select(3);
+		SWTableAutoFMT.ok();
+		// verify the auto format is that just selected
+		button("sw:PushButton:DLG_INSERT_TABLE:BT_AUTOFORMAT").click();
+		assertEquals("Blue", SWTableAutoFormat_Listbox.getSelText());
+		SWTableAutoFMT.close();
+		writer_InsertTable.ok();
+		assertNotNull(StatusBar.getItemTextById(8));
+
+	}
+
+	// set row height and select row,insert/delete row
+
+	@Test
+	public void testTableRowHeight() throws Exception {
+		writer_InsertTable.ok();
+		assertNotNull(StatusBar.getItemTextById(8));
+
+		// set row height
+		writer.focus();
+		writer.openContextMenu();
+		SWTable_RowHeightMenu.select();
+		assertTrue(SWTable_SetRowHeight_Dialog.exists());
+		SWTable_SetRowHeight.focus();
+		typeKeys("<ctrl a>");
+		typeKeys("<delete>");
+		typeKeys("0.5");
+		SWTable_SetRowHeight_Dialog.ok();
+
+		// verify row height
+		writer.focus();
+		writer.openContextMenu();
+		SWTable_RowHeightMenu.select();
+		assertTrue(SWTable_SetRowHeight_Dialog.exists());
+		assertEquals("0.50\"", SWTable_SetRowHeight.getText());
+		SWTable_SetRowHeight_Dialog.close();
+	}
+
+	// select row
+	@Test
+	public void testTableSelectRow() throws Exception {
+		writer_InsertTable.ok();
+		assertNotNull(StatusBar.getItemTextById(8));
+		// select row
+		writer.focus();
+		writer.openContextMenu();
+		SWTable_SelectRowMenu.select();
+
+		// verify select one row successfully
+		typeKeys("<ctrl c>");
+		typeKeys("<down>");
+		typeKeys("<down>");
+		typeKeys("<enter>");
+		typeKeys("<ctrl v>");
+		typeKeys("<up>");
+		assertTrue(Table_Toolbar.exists());
+
+	}
+
+	// insert row and verify how many row inserted
+	@Test
+	public void testTableInsertRow() throws Exception {
+		writer_InsertTable.ok();
+		assertNotNull(StatusBar.getItemTextById(8));
+		writer.focus();
+		writer.openContextMenu();
+		SWTable_InsertRowMenu.select();
+		assertTrue("SWTable_InsertRow Dialog pop up",
+				SWTable_InsertRow.exists());
+		SWTable_InsertRow_Column_SetNumber.focus();
+		typeKeys("<ctrl a>");
+		typeKeys("<delete>");
+		typeKeys("3");
+		SWTable_InsertRow.ok();
+
+		writer.focus(); // verify how many rows in the table
+		assertNotNull(StatusBar.getItemTextById(8));
+		for (int i = 0; i < 4; i++) {
+			typeKeys("<down>");
+			assertNotNull(StatusBar.getItemTextById(8));
+		}
+		typeKeys("<down>");
+		sleep(1);
+		assertFalse(Table_Toolbar.exists());
+	}
+
+	// delete row and verify row
+	@Test
+	public void testTableRowDelete() throws Exception {
+		writer_InsertTable.ok();
+		assertNotNull(StatusBar.getItemTextById(8));
+		// delete row
+		writer.focus();
+		writer.openContextMenu();
+		SWTable_RowDleteMenu.select();
+		// verify whether delete row
+		writer.focus();
+		assertNotNull(StatusBar.getItemTextById(8));
+		typeKeys("<down>");
+		sleep(1);
+		assertFalse(Table_Toolbar.exists());
+
+	}
+
+	// set column width and verify
+	@Test
+	public void testTableColumnWidth() throws Exception {
+		writer_InsertTable.ok();
+		assertNotNull(StatusBar.getItemTextById(8));
+		// set column width
+		writer.focus();
+		writer.openContextMenu();
+		SWTable_ColumnWidthMenu.select();
+		SWTable_SetColumnWidth.focus();
+		typeKeys("<ctrl a>");
+		typeKeys("<delete>");
+		typeKeys("2");
+		SWTable_SetColumnDialog.ok();
+		// verify column width
+		writer.focus();
+		writer.openContextMenu();
+		SWTable_ColumnWidthMenu.select();
+		assertEquals("2.00\"", SWTable_SetColumnWidth.getText());
+
+	}
+
+	// select column and verify
+	@Test
+	public void testTableColumnSelect() throws Exception {
+		writer_InsertTable.ok();
+		assertNotNull(StatusBar.getItemTextById(8));
+		writer.focus();
+		writer.openContextMenu();
+		SWTable_ColumnSelectMenu.select();
+
+		// verify select one column
+		typeKeys("<ctrl c>");
+		typeKeys("<down>");
+		typeKeys("<down>");
+		typeKeys("<enter>");
+		typeKeys("<ctrl v>");
+		typeKeys("<up>");
+		assertTrue(Table_Toolbar.exists());
+
+	}
+
+	// insert column and verify
+	@Test
+	public void testTableColumnInsert() throws Exception {
+		writer_InsertTable.ok();
+		assertNotNull(StatusBar.getItemTextById(8));
+		// insert column
+		writer.focus();
+		writer.openContextMenu();
+		SWTable_ColumnInsertMenu.select();
+		SWTable_InsertRow_Column_SetNumber.focus();
+		typeKeys("<ctrl a>");
+		typeKeys("<delete>");
+		typeKeys("3");
+		SWTable_InsertColumn.ok();
+		// verify insert column successfully
+		writer.focus();
+		assertTrue(Table_Toolbar.exists());
+		for (int i = 0; i < 9; i++) {
+			typeKeys("<right>");
+			sleep(1);
+			assertTrue(Table_Toolbar.exists());
+		}
+		typeKeys("<right>");
+		sleep(1);
+		assertFalse(Table_Toolbar.exists());
+	}
+
+	// delete column and verify whether delete or not
+	public void testTableColumnDelete() throws Exception {
+		writer_InsertTable.ok();
+		assertNotNull(StatusBar.getItemTextById(8));
+		// delete column
+		writer.focus();
+		writer.openContextMenu();
+		SWTable_ColumnDeleteMenu.select();
+		// verify delete column
+		writer.focus();
+		assertTrue(Table_Toolbar.exists());
+		for (int i = 0; i < 7; i++) {
+			typeKeys("<right>");
+			assertTrue(Table_Toolbar.exists());
+		}
+		sleep(1);
+		assertFalse(Table_Toolbar.exists());
+	}
+
+	// split cell
+	@Test
+	public void testTableCellSplit() throws Exception {
+		writer_InsertTable.ok();
+		assertTrue(Table_Toolbar.exists());
+		for (int k = 0; k < 2; k++) {
+			writer.focus();
+			writer.openContextMenu();
+			SWTable_CellSplitMenu.select();
+			SWTable_CellSplitNumber.focus();
+			typeKeys("<ctrl a>");
+			typeKeys("<delete>");
+			typeKeys("2");
+			if (k == 0) {
+				SWTable_CellSplitDialog.ok(); // split table cell horizontally
+			} else {
+				SWTable_CellSplitVERT_Button.check(); // split table cell
+				// vertically
+				SWTable_CellSplitDialog.ok();
+			}
+		}
+		// verify cell split successfully
+		writer.focus();
+		assertTrue(Table_Toolbar.exists());
+		for (int i = 0; i < 7; i++) {
+			typeKeys("<right>");
+			assertTrue(Table_Toolbar.exists());
+		}
+		sleep(1);
+		assertFalse(Table_Toolbar.exists());
+	}
+	
+	/**
+	 * Test convert table to text in text document
+	 * 
+	 * @throws Exception
+	 */
+	@Test
+	public void testConvertTableToText() throws Exception {
+		writer_InsertTable.ok();
+		writer.focus();
+		typeKeys("1<right>2<right>3<right>4");
+		sleep(1);
+
+		// Convert table to text
+		app.dispatch(".uno:ConvertTableToText");
+		assertTrue("Convert Table to Text dialog pop up", writer_ConvertTableToTextDlg.exists());
+		// typeKeys("<enter>");
+		writer_ConvertTableToTextDlg.ok(); // "Enter" does not work on linux
+
+		// Verify if text is converted successfully
+		app.dispatch(".uno:SelectAll");
+		app.dispatch(".uno:Copy");
+		if (SystemUtil.isWindows())
+			assertEquals("Converted text", "1\t2\r\n3\t4\r\n", app.getClipboard()); // in
+																					// windows,
+																					// \n
+																					// is
+																					// \r\n
+		else
+			assertEquals("Converted text", "1\t2\n3\t4\n", app.getClipboard());
+	}
+}
\ No newline at end of file

Modified: incubator/ooo/trunk/test/testgui/source/testlib/gui/UIMap.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testgui/source/testlib/gui/UIMap.java?rev=1379259&r1=1379258&r2=1379259&view=diff
==============================================================================
--- incubator/ooo/trunk/test/testgui/source/testlib/gui/UIMap.java (original)
+++ incubator/ooo/trunk/test/testgui/source/testlib/gui/UIMap.java Fri Aug 31 02:27:34 2012
@@ -469,5 +469,52 @@ public class UIMap {
 
 	// Fontwork
 	public static final VclDialog FontworkGalleryDlg = dialog("svx:ModalDialog:RID_SVX_MDLG_FONTWORK_GALLERY");
+	
+	public static final VclEditBox SWTableSizeColBox=editbox("sw:NumericField:DLG_INSERT_TABLE:ED_COL");
+	public static final VclEditBox SWTableSizeRowBox=editbox("sw:NumericField:DLG_INSERT_TABLE:ED_ROW");
+	public static final VclControl SWTableBackgroundColor=control("CUI_HID_BACKGROUND_CTL_BGDCOLORSET");
+	public static final VclTabPage SWTableBackground = tabpage("CUI_HID_BACKGROUND");
+	public static final VclTabPage SWTableBorder = tabpage("CUI_HID_BORDER");
+	public static final VclControl SWTableBorderLineArrange = control("CUI_HID_BORDER_CTL_PRESETS");
+	public static final VclControl SWTableProperties = control("SW_HID_FORMAT_TABLE");
+	public static final VclListBox SWTableBorderLineStyle = listbox("cui:ListBox:RID_SVXPAGE_BORDER:LB_LINESTYLE");
+	public static final VclListBox SWTableBorderLineColor = listbox("cui:ListBox:RID_SVXPAGE_BORDER:LB_LINECOLOR");
+	public static final VclEditBox SWTableSTCLeft = editbox("cui:MetricField:RID_SVXPAGE_BORDER:MF_LEFT");
+	public static final VclEditBox SWTableSTCRight = editbox("cui:MetricField:RID_SVXPAGE_BORDER:MF_RIGHT");
+	public static final VclEditBox SWTableSTCTop = editbox("cui:MetricField:RID_SVXPAGE_BORDER:MF_TOP");
+	public static final VclEditBox SWTableSTCBottom = editbox("cui:MetricField:RID_SVXPAGE_BORDER:MF_BOTTOM");
+	public static final VclButton SWTableSTC_SYNC = button("cui:CheckBox:RID_SVXPAGE_BORDER:CB_SYNC");
+	public static final VclControl SWTableShadow = control("CUI_HID_BORDER_CTL_SHADOWS");
+	public static final VclEditBox SWTableShadowSize = editbox("cui:MetricField:RID_SVXPAGE_BORDER:ED_SHADOWSIZE");
+	public static final VclListBox SWTableShadowColor = listbox("cui:ListBox:RID_SVXPAGE_BORDER:LB_SHADOWCOLOR");
+	public static final VclButton SWInsertTable_AutoFormat = button("sw:PushButton:DLG_INSERT_TABLE:BT_AUTOFORMAT");
+	public static final VclListBox SWTableAutoFormat_Listbox = listbox("sw:ListBox:DLG_AUTOFMT_TABLE:LB_FORMAT");
+	public static final VclDialog SWTableAutoFMT = dialog("SW_HID_AUTOFMT_TABLE");
+	public static final VclDialog SWTable_SetRowHeight_Dialog = dialog(".uno:SetRowHeight");
+	public static final VclField SWTable_SetRowHeight = field("sw:MetricField:DLG_ROW_HEIGHT:ED_HEIGHT");
+	public static final VclDialog SWTable_InsertRow = dialog(".uno:InsertRowDialog");
+	public static final VclEditBox SWTable_InsertRow_Column_SetNumber = editbox("cui:NumericField:DLG_INS_ROW_COL:ED_COUNT");
+	public static final VclField SWTable_SetColumnNumber = field("sw:NumericField:DLG_COL_WIDTH:ED_COL");
+	public static final VclField SWTable_SetColumnWidth = field("sw:MetricField:DLG_COL_WIDTH:ED_WIDTH");
+	public static final VclDialog SWTable_InsertColumn = dialog(".uno:InsertColumnDialog");
+	public static final VclDialog SWTable_SetColumnDialog = dialog(".uno:SetColumnWidth");
+	public static final VclDialog SWTable_CellSplitDialog = dialog("cui:ModalDialog:RID_SVX_SPLITCELLDLG");
+	public static final VclField SWTable_CellSplitNumber = field("cui:NumericField:RID_SVX_SPLITCELLDLG:ED_COUNT");
+	public static final VclButton SWTable_CellSplitHORZ_Button = button("cui:ImageRadioButton:RID_SVX_SPLITCELLDLG:RB_HORZ");
+	public static final VclButton SWTable_CellSplitVERT_Button = button("cui:ImageRadioButton:RID_SVX_SPLITCELLDLG:RB_VERT");
+	public static final VclMenuItem SWTable_SelectRowMenu=new VclMenuItem("Row->Select");
+	public static final VclMenuItem SWTable_InsertRowMenu=new VclMenuItem("Row->Insert...");
+	public static final VclMenuItem SWTable_RowHeightMenu=new VclMenuItem("Row->Height...");
+	public static final VclMenuItem SWTable_RowDleteMenu=new VclMenuItem("Row->Delete");
+	public static final VclMenuItem SWTable_ColumnWidthMenu=new VclMenuItem("Column->Width...");
+	public static final VclMenuItem SWTable_ColumnSelectMenu=new VclMenuItem("Column->Select");
+	public static final VclMenuItem SWTable_ColumnDeleteMenu=new VclMenuItem("Column->Delete");
+	public static final VclMenuItem SWTable_ColumnInsertMenu=new VclMenuItem("Column->Insert...");
+	public static final VclMenuItem SWTable_CellSplitMenu=new VclMenuItem("Cell->Split...");
+	public static final VclListBox SDTable_BACGColorListbox = listbox("cui:ListBox:RID_SVXPAGE_AREA:LB_COLOR");
+	public static final VclTabPage SDTable_BACGColorArea = tabpage("CUI_HID_AREA_AREA");
+	public static final VclTabPage SDTable_BACGColorsOption = tabpage("CUI_HID_OPTIONS_COLOR");
+	public static final VclEditBox SDTable_BACGColorsOption_Name = editbox("cui:Edit:RID_SVXPAGE_COLOR:EDT_NAME");
+	
 
 }



Mime
View raw message