incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liu...@apache.org
Subject svn commit: r1358925 - in /incubator/ooo/trunk/main/test: testcommon/source/org/openoffice/test/vcl/widgets/ testoo/src/testcase/sc/sheet/ testoo/src/testlib/
Date Mon, 09 Jul 2012 05:58:23 GMT
Author: liuzhe
Date: Mon Jul  9 05:58:23 2012
New Revision: 1358925

URL: http://svn.apache.org/viewvc?rev=1358925&view=rev
Log:

#120218# [VCLAuto patch]The getID() can not find the menu item expected while there is any
menu item which contains the string.
         Patch by: Zhu Shan
         Reviewed by: Liu Zhe

Added:
    incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/
    incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/InsertMultipleSheets.java
    incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/InsertOneSheet.java
Modified:
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMenuItem.java
    incubator/ooo/trunk/main/test/testoo/src/testlib/UIMap.java

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMenuItem.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMenuItem.java?rev=1358925&r1=1358924&r2=1358925&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMenuItem.java
(original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclMenuItem.java
Mon Jul  9 05:58:23 2012
@@ -100,7 +100,9 @@ public class VclMenuItem {
 				if (item == null)
 					continue;
 				String itemText = path[path.length - 1];
-				if (item.getTextWithoutMneumonic().contains(itemText)) {
+//				if (item.getTextWithoutMneumonic().contains(itemText)) {
+				//Change "contains" into "equals" to avoid the blocking while search for menu item
+				if (item.getTextWithoutMneumonic().equals(itemText)) {
 					return item.getId();
 				}
 			}

Added: incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/InsertMultipleSheets.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/InsertMultipleSheets.java?rev=1358925&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/InsertMultipleSheets.java (added)
+++ incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/InsertMultipleSheets.java Mon
Jul  9 05:58:23 2012
@@ -0,0 +1,74 @@
+package testcase.sc.sheet;
+
+import static org.junit.Assert.*;
+import static org.openoffice.test.vcl.Tester.sleep;
+import static testlib.AppUtil.initApp;
+import static testlib.UIMap.*;
+import static testlib.UIMap.startcenter;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import testlib.Log;
+
+/**
+ * Before running the testing class, you need specify the AOO location firstly with system
property openoffice.home.
+ * 
+ * @author Shan Zhu
+ *
+ */
+
+public class InsertMultipleSheets {
+
+	/**
+	 * TestCapture helps us to do
+	 * 1. Take a screenshot when failure occurs.
+	 * 2. Collect extra data when OpenOffice crashes.
+	 */	
+	@Rule
+	public Log LOG = new Log();
+	
+	/**
+	 * initApp helps us to do 
+	 * 1. Patch the OpenOffice to enable automation if necessary.
+	 * 2. Start OpenOffice with automation enabled if necessary.
+	 * 3. Reset OpenOffice to startcenter.
+	 * 
+	 * @throws java.lang.Exception
+	 */
+	@Before
+	public void setUp() throws Exception {
+		initApp();
+	}
+	
+	/**
+	 * Insert one sheet in different place
+	 * @throws Exception
+	 */
+	@Test
+	public void testInsertOneSheet(){
+		//Create a new Spreadsheet
+		startcenter.menuItem("File->New->Spreadsheet").select();
+		calc.waitForExistence(10, 3);
+		sleep(3);
+		
+		//Open Insert Sheet dialog via main menu Insert-> Sheet
+		calc.menuItem("Insert->Sheet...").select();
+		sleep(2);
+		//Change new sheet number into 3 to insert 3 new sheet one time
+		SCSheetNumber.setText("3");
+		
+		//Click OK button to create sheet with default setting
+		SCInsertSheetDlg.ok();
+		sleep(5);
+		
+		//Verify new sheets have been inserted before Sheet1
+		calc.menuItem("Edit->Sheet->Select...").select();
+		sleep(2);
+		assertEquals(6, SCSheetsList.getItemCount());
+		assertEquals("Sheet4",SCSheetsList.getItemText(0,0));
+		assertEquals("Sheet6",SCSheetsList.getItemText(2,0));
+		
+	}
+}

Added: incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/InsertOneSheet.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/InsertOneSheet.java?rev=1358925&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/InsertOneSheet.java (added)
+++ incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/InsertOneSheet.java Mon Jul
 9 05:58:23 2012
@@ -0,0 +1,70 @@
+package testcase.sc.sheet;
+
+import static org.junit.Assert.*;
+import static org.openoffice.test.vcl.Tester.sleep;
+import static testlib.AppUtil.initApp;
+import static testlib.UIMap.*;
+import static testlib.UIMap.startcenter;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import testlib.Log;
+
+/**
+ * Before running the testing class, you need specify the AOO location firstly with system
property openoffice.home.
+ * 
+ * @author Shan Zhu
+ *
+ */
+
+public class InsertOneSheet {
+
+	/**
+	 * TestCapture helps us to do
+	 * 1. Take a screenshot when failure occurs.
+	 * 2. Collect extra data when OpenOffice crashes.
+	 */	
+	@Rule
+	public Log LOG = new Log();
+	
+	/**
+	 * initApp helps us to do 
+	 * 1. Patch the OpenOffice to enable automation if necessary.
+	 * 2. Start OpenOffice with automation enabled if necessary.
+	 * 3. Reset OpenOffice to startcenter.
+	 * 
+	 * @throws java.lang.Exception
+	 */
+	@Before
+	public void setUp() throws Exception {
+		initApp();
+	}
+	
+	/**
+	 * Insert one sheet in different place
+	 * @throws Exception
+	 */
+	@Test
+	public void testInsertOneSheet(){
+		//Create a new Spreadsheet
+		startcenter.menuItem("File->New->Spreadsheet").select();
+		calc.waitForExistence(10, 3);
+		sleep(3);
+		
+		//Open Insert Sheet dialog via main menu Insert-> Sheet
+		calc.menuItem("Insert->Sheet...").select();
+		sleep(2);
+		
+		//Click OK button to create sheet with default setting
+		SCInsertSheetDlg.ok();
+		sleep(5);
+		
+		//Verify new sheet has been inserted before Sheet1
+		calc.menuItem("Edit->Sheet->Select...").select();
+		sleep(2);
+		assertEquals("Sheet4",SCSheetsList.getItemText(0,0));
+		
+	}
+}

Modified: incubator/ooo/trunk/main/test/testoo/src/testlib/UIMap.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testoo/src/testlib/UIMap.java?rev=1358925&r1=1358924&r2=1358925&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testoo/src/testlib/UIMap.java (original)
+++ incubator/ooo/trunk/main/test/testoo/src/testlib/UIMap.java Mon Jul  9 05:58:23 2012
@@ -335,4 +335,21 @@ public class UIMap {
 	public static final VclDialog SortWarningDlg = dialog("sc:ModalDialog:RID_SCDLG_SORT_WARNING");
 	public static final VclButton SortWarningDlg_Extend = button("sc:PushButton:RID_SCDLG_SORT_WARNING:BTN_EXTSORT");
 	public static final VclButton SortWarningDlg_Current = button("sc:PushButton:RID_SCDLG_SORT_WARNING:BTN_CURSORT");
+	// Spreadsheet: "Sheet" dialog
+	public static final VclDialog SCInsertSheetDlg = dialog("sc:ModalDialog:RID_SCDLG_INSERT_TABLE");
+	public static final VclButton SCBeforeCurrentSheet = button("sc:RadioButton:RID_SCDLG_INSERT_TABLE:RB_BEFORE");
+	public static final VclButton SCAfterCurrentSheet = button("sc:RadioButton:RID_SCDLG_INSERT_TABLE:RB_BEHIND");
+	public static final VclButton SCNewSheet = button("sc:RadioButton:RID_SCDLG_INSERT_TABLE:RB_NEW");
+	public static final VclButton SCNewSheetFromFile = button("sc:RadioButton:RID_SCDLG_INSERT_TABLE:RB_FROMFILE");
+	public static final VclEditBox SCNewSheetName = editbox("sc:Edit:RID_SCDLG_INSERT_TABLE:ED_TABNAME");
+	public static final VclField SCSheetNumber = field("sc:NumericField:RID_SCDLG_INSERT_TABLE:NF_COUNT");
+	public static final VclListBox SCFromFileSheetList = listbox("sc:MultiListBox:RID_SCDLG_INSERT_TABLE:LB_TABLES");
+	public static final VclButton SCFromFileBrowse = button("sc:PushButton:RID_SCDLG_INSERT_TABLE:BTN_BROWSE");
+	public static final VclButton SCFromFileLink = button("sc:CheckBox:RID_SCDLG_INSERT_TABLE:CB_LINK");
+	// Spreadsheet: "Select Sheets" dialog
+	public static final VclDialog SCSelectSheetsDlg = dialog(".uno:SelectTables");
+	public static final VclListBox SCSheetsList = listbox("SC_HID_SELECTTABLES");
+	
+	
+	
 }



Mime
View raw message