incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liu...@apache.org
Subject svn commit: r1359496 - in /incubator/ooo/trunk/main/test: testcommon/source/org/openoffice/test/vcl/widgets/VclApp.java testoo/src/testcase/sc/sheet/InsertSheet.java
Date Tue, 10 Jul 2012 07:05:30 GMT
Author: liuzhe
Date: Tue Jul 10 07:05:30 2012
New Revision: 1359496

URL: http://svn.apache.org/viewvc?rev=1359496&view=rev
Log:
Merge two test classes into one test class. 

Added:
    incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/InsertSheet.java
      - copied, changed from r1358926, incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/InsertMultipleSheets.java
Modified:
    incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclApp.java

Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclApp.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclApp.java?rev=1359496&r1=1359495&r2=1359496&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclApp.java
(original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/vcl/widgets/VclApp.java
Tue Jul 10 07:05:30 2012
@@ -89,6 +89,8 @@ public class VclApp {
 		try {
 			dispatch(".uno:Quit");
 			SystemUtil.sleep(3);
+		} catch(Exception e) {
+			
 		} finally {
 			communicationManager.stop();
 			if (openOffice != null) {

Copied: incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/InsertSheet.java (from
r1358926, 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/InsertSheet.java?p2=incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/InsertSheet.java&p1=incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/InsertMultipleSheets.java&r1=1358926&r2=1359496&rev=1359496&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/InsertMultipleSheets.java (original)
+++ incubator/ooo/trunk/main/test/testoo/src/testcase/sc/sheet/InsertSheet.java Tue Jul 10
07:05:30 2012
@@ -21,11 +21,10 @@
 package testcase.sc.sheet;
 
 import static org.junit.Assert.*;
-import static org.openoffice.test.vcl.Tester.sleep;
-import static testlib.AppUtil.initApp;
+import static org.openoffice.test.vcl.Tester.*;
 import static testlib.UIMap.*;
-import static testlib.UIMap.startcenter;
 
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -38,27 +37,21 @@ import testlib.Log;
  *
  */
 
-public class InsertMultipleSheets {
+public class InsertSheet {
 
-	/**
-	 * 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();
+		app.start();
+		app.dispatch("private:factory/scalc");
+		calc.waitForExistence(10, 3);
+	}
+
+	@After
+	public void tearDown() throws Exception {
+		app.close();
 	}
 	
 	/**
@@ -66,28 +59,32 @@ public class InsertMultipleSheets {
 	 * @throws Exception
 	 */
 	@Test
-	public void testInsertOneSheet(){
-		//Create a new Spreadsheet
-		startcenter.menuItem("File->New->Spreadsheet").select();
-		calc.waitForExistence(10, 3);
-		sleep(3);
-		
+	public void testInsertMultipleSheet(){
 		//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));
-		
+		assertArrayEquals(new String[] { "Sheet4", "Sheet5", "Sheet6", "Sheet1", "Sheet2", "Sheet3"
}, SCSheetsList.getItemsText());
+		SCSelectSheetsDlg.ok();
+	}
+	
+	/**
+	 * Insert one sheet in different place
+	 * @throws Exception
+	 */
+	@Test
+	public void testInsertOneSheet(){
+		//Open Insert Sheet dialog via main menu Insert-> Sheet
+		calc.menuItem("Insert->Sheet...").select();
+		//Click OK button to create sheet with default setting
+		SCInsertSheetDlg.ok();
+		//Verify new sheet has been inserted before Sheet1
+		calc.menuItem("Edit->Sheet->Select...").select();
+		assertArrayEquals(new String[]{"Sheet4", "Sheet1", "Sheet2", "Sheet3"},SCSheetsList.getItemsText());
+		SCSelectSheetsDlg.ok();
 	}
 }



Mime
View raw message