incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liu...@apache.org
Subject svn commit: r1391739 - in /incubator/ooo/trunk/test/testgui: data/pvt/complex.xls data/pvt/complex.xlsx data/pvt/complex_29s.xls data/pvt/complex_29s.xlsx source/pvt/gui/Benchmark.java
Date Sat, 29 Sep 2012 03:03:56 GMT
Author: liuzhe
Date: Sat Sep 29 03:03:55 2012
New Revision: 1391739

URL: http://svn.apache.org/viewvc?rev=1391739&view=rev
Log:
Add cases in GUI PVT

Added:
    incubator/ooo/trunk/test/testgui/data/pvt/complex_29s.xls
      - copied unchanged from r1391724, incubator/ooo/trunk/test/testgui/data/pvt/complex.xls
    incubator/ooo/trunk/test/testgui/data/pvt/complex_29s.xlsx
      - copied unchanged from r1391724, incubator/ooo/trunk/test/testgui/data/pvt/complex.xlsx
Removed:
    incubator/ooo/trunk/test/testgui/data/pvt/complex.xls
    incubator/ooo/trunk/test/testgui/data/pvt/complex.xlsx
Modified:
    incubator/ooo/trunk/test/testgui/source/pvt/gui/Benchmark.java

Modified: incubator/ooo/trunk/test/testgui/source/pvt/gui/Benchmark.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testgui/source/pvt/gui/Benchmark.java?rev=1391739&r1=1391738&r2=1391739&view=diff
==============================================================================
--- incubator/ooo/trunk/test/testgui/source/pvt/gui/Benchmark.java (original)
+++ incubator/ooo/trunk/test/testgui/source/pvt/gui/Benchmark.java Sat Sep 29 03:03:55 2012
@@ -34,6 +34,7 @@ import static testlib.gui.UIMap.*;
 import java.awt.Rectangle;
 import java.util.HashMap;
 
+import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Rule;
@@ -57,7 +58,9 @@ public class Benchmark {
 	
 	private static final double INTERVAL = 0.1; 
 	
-	private static int repeat = 8;
+	private static int repeat = 2;
+	
+	private int i  = 0;
 	
 	public Benchmark() {
 
@@ -66,7 +69,7 @@ public class Benchmark {
 	@BeforeClass
 	public static void beforeClass() throws Exception {
 		OpenOffice.killAll();
-		result = new DataSheet(getFile("output/pvt_gui_benchmark.xml"), true);
+		result = new DataSheet(getFile("output/" + Benchmark.class.getName() + ".xml"), true);
 		result.addRow("data", "Scenario", "No", "Consumed Time", "Memory(VSZ)", "Memory(RSS)",
"Handles(Windows Only)");
 	}
 	
@@ -75,7 +78,13 @@ public class Benchmark {
 		app.stop();
 	}
 	
-	private void addRecord(int i, long start, long end) {
+	@After
+	public void after() {
+		if (i < repeat)
+			result.addRow("data", testname.getMethodName(), i, "err", "err", "err", "err", "err");
+	}
+	
+	private void addRecord(long start, long end) {
 		sleep(2);
 		HashMap<String, Object>  perf = aoo.getPerfData();
 		result.addRow("data", testname.getMethodName(), i, (end - start), perf.get("vsz"), perf.get("rss"),
perf.get("handles"));
@@ -84,16 +93,17 @@ public class Benchmark {
 	@Test
 	public void coolStartup() throws Exception {
 		app.stop();
-		for (int i = 0; i < repeat; i++) {
+		for (i = 0; i < repeat; i++) {
 			aoo.cleanUserInstallation();
 			assertFalse("User profile exists", aoo.getUserInstallation().exists());
 			aoo.start();
 			long start = System.currentTimeMillis();
 			startcenter.waitForExistence(120, INTERVAL);
 			long end = System.currentTimeMillis();
-			addRecord(i, start, end);
+			addRecord(start, end);
 			app.quit();
 		}
+		
 	}
 	
 	@Test
@@ -102,15 +112,16 @@ public class Benchmark {
 		app.start(true);
 		app.quit();
 		
-		for (int i = 0; i < repeat; i++) {
+		for (i = 0; i < repeat; i++) {
 			assertTrue("User profile exists", aoo.getUserInstallation().exists());
 			aoo.start();
 			long start = System.currentTimeMillis();
 			startcenter.waitForExistence(120, INTERVAL);
 			long end = System.currentTimeMillis();
-			addRecord(i, start, end);
+			addRecord(start, end);
 			app.quit();
 		}
+		
 	}
 
 	@Test
@@ -118,46 +129,49 @@ public class Benchmark {
 		app.start(true);
 		app.quit();
 		
-		for (int i = 0; i < repeat; i++) {
+		for (i = 0; i < repeat; i++) {
 			app.start();
 			startCenterWriterButton.click(0.5, 0.5);
 			long start = System.currentTimeMillis();
 			writer.waitForExistence(60, INTERVAL);
 			long end = System.currentTimeMillis();
-			addRecord(i, start, end);
+			addRecord(start, end);
 			app.quit();
 		}
+		
 	}
 
 	@Test
 	public void newSpreadsheet() {
 		app.start(true);
 		app.quit();
-		for (int i = 0; i < repeat; i++) {
+		for (i = 0; i < repeat; i++) {
 			app.start();
 			startCenterCalcButton.click(0.5, 0.5);
 			long start = System.currentTimeMillis();
 			calc.waitForExistence(60, INTERVAL);
 			long end = System.currentTimeMillis();
-			addRecord(i, start, end);
+			addRecord(start, end);
 			app.quit();
 		}
+		
 	}
 	
 	@Test
 	public void newPresentation() {
 		app.start(true);
 		app.quit();
-		for (int i = 0; i < repeat; i++) {
+		for (i = 0; i < repeat; i++) {
 			app.start();
 			startCenterImpressButton.click(0.5, 0.5);
 			presentationWizard.click(0.9, 0.95);
 			long start = System.currentTimeMillis();
 			impress.waitForExistence(60, INTERVAL);
 			long end = System.currentTimeMillis();
-			addRecord(i, start, end);
+			addRecord(start, end);
 			app.quit();
 		}
+		
 	}
 	
 	@Test
@@ -169,7 +183,7 @@ public class Benchmark {
 		final Rectangle rect = GraphicsUtil.getScreenRectangle();
 		// when slide show is running, top-center area will be filled with green
 		rect.setRect(rect.getCenterX(), 2, 2, 2);
-		for (int i = 0; i < repeat; i++) {
+		for (i = 0; i < repeat; i++) {
 			app.start();
 			open(path);
 			impress.waitForExistence(60, 1);
@@ -186,11 +200,12 @@ public class Benchmark {
 				
 			}.waitForTrue("", 120, INTERVAL);
 			long end = System.currentTimeMillis();
-			addRecord(i, start, end);
+			addRecord(start, end);
 			slideShow.typeKeys("<esc>");
 			sleep(2);
 			app.quit();
 		}
+		
 	}
 	
 	@Test
@@ -205,7 +220,7 @@ public class Benchmark {
 	
 	@Test
 	public void loadFinishPlainDOCX() {
-		loadFinish("pvt/plain_200p.docx", "Page 1 / 19[0-9]{1}");
+		loadFinish("pvt/plain_200p.docx", "Page 1 / 1[8-9]{1}[0-9]{1}");
 	}
 	
 	@Test
@@ -245,7 +260,7 @@ public class Benchmark {
 	
 	@Test
 	public void loadFinishComplexDOCX() {
-		loadFinish("pvt/complex_400p.doc", "Page 1 / 4[0-9]{2}");
+		loadFinish("pvt/complex_400p.docx", "Page 1 / 4[0-9]{2}");
 	}
 	
 	@Test
@@ -259,15 +274,35 @@ public class Benchmark {
 	}
 	
 	@Test
+	public void loadFinishComplexXLS() {
+		loadFinish("pvt/complex_29s.xls", "Sheet 2 / 29");
+	}
+	
+	@Test
+	public void loadFinishComplexXLSX() {
+		loadFinish("pvt/complex_29s.xlsx", "Sheet 29 / 29");
+	}
+	
+	@Test
 	public void loadFinishComplexODP() {
 		loadFinish("pvt/complex_150p.odp", "Slide 1 / 150");
 	}
 	
+	@Test
+	public void loadFinishComplexPPT() {
+		loadFinish("pvt/complex_100p.ppt", "Slide 1 / 100");
+	}
+	
+	@Test
+	public void loadFinishComplexPPTX() {
+		loadFinish("pvt/complex_100p.pptx", "Slide 1 / 100");
+	}
+	
 	public void loadFinish(String file, final String indicator) {
 		final int openIndicatorIndex = file.matches(".*\\.(odp|ppt|pptx)$") ? 4 : 0;
 		String path = prepareData(file);
 		app.stop();
-		for (int i = 0; i < 8; i++) {
+		for (i = 0; i < repeat; i++) {
 			app.start();
 			app.dispatch(".uno:Open");
 			filePickerPath.setText(path);
@@ -287,15 +322,11 @@ public class Benchmark {
 				
 			}.waitForTrue("", 120, INTERVAL);
 			long end = System.currentTimeMillis();
-			addRecord(i, start, end);
+			addRecord(start, end);
 			discard();
 			app.quit();
 		}
-	}
-	
-	@Test
-	public void savePlainDOC() {
-		save("pvt/plain_50p.doc", "Page i / 5[0-9]{1}");
+		
 	}
 	
 	@Test
@@ -304,13 +335,13 @@ public class Benchmark {
 	}
 	
 	@Test
-	public void saveComplexDOC() {
-		save("pvt/complex_300p.doc", "Page 1 / 3[0-9]{2}");
+	public void savePlainDOC() {
+		save("pvt/plain_50p.doc", "Page i / 5[0-9]{1}");
 	}
 	
 	@Test
-	public void saveComplexODT() {
-		save("pvt/complex_800p.odt", "Page 1 / 8[0-9]{2}");
+	public void savePlainODS() {
+		save("pvt/plain_11s.ods", "Sheet 1 / 11");
 	}
 	
 	@Test
@@ -319,23 +350,33 @@ public class Benchmark {
 	}
 	
 	@Test
-	public void savePlainODS() {
-		save("pvt/plain_11s.ods", "Sheet 1 / 11");
+	public void savePlainODP() {
+		save("pvt/plain_200p.odp", "Slide 1 / 200");
 	}
 	
 	@Test
-	public void saveComplexODS() {
-		save("pvt/complex_19s.ods", "Sheet 8 / 19");
+	public void savePlainPPT() {
+		save("pvt/plain_200p.ppt", "Slide 1 / 200");
 	}
 	
 	@Test
-	public void savePlainODP() {
-		save("pvt/plain_200p.odp", "Slide 1 / 200");
+	public void saveComplexODT() {
+		save("pvt/complex_800p.odt", "Page 1 / 8[0-9]{2}");
 	}
 	
 	@Test
-	public void savePlainPPT() {
-		save("pvt/plain_200p.ppt", "Slide 1 / 200");
+	public void saveComplexDOC() {
+		save("pvt/complex_300p.doc", "Page 1 / 3[0-9]{2}");
+	}
+
+	@Test
+	public void saveComplexODS() {
+		save("pvt/complex_19s.ods", "Sheet 8 / 19");
+	}
+
+	@Test
+	public void saveComplexXLS() {
+		save("pvt/complex_29s.xls", "Sheet 2 / 29");
 	}
 	
 	@Test
@@ -343,13 +384,18 @@ public class Benchmark {
 		save("pvt/complex_150p.odp", "Slide 1 / 150");
 	}
 	
+	@Test
+	public void saveComplexPPT() {
+		save("pvt/complex_100p.ppt", "Slide 1 / 100");
+	}
+	
 	public void save(String file, final String openIndicator) {
 		boolean alienFormat = file.matches(".*\\.(doc|xls|ppt|docx|xlsx|pptx)$");
 		final int openIndicatorIndex = file.matches(".*\\.(odp|ppt|pptx)$") ? 4 : 0;
 		final int saveIndicatorIndex = file.matches(".*\\.(odt|doc|docx)$") ? 5 : file.matches(".*\\.(ods|xls|xlsx)$")
? 4 : 2;
 		app.stop();
 		String picture = prepareData("image/red_64x64.bmp");
-		for (int i = 0; i < repeat; i++) {
+		for (i = 0; i < repeat; i++) {
 			String dir = "temp/file" + i;
 			getFile(dir).mkdirs();
 			app.start();
@@ -391,9 +437,10 @@ public class Benchmark {
 				
 			}.waitForTrue("", 120, INTERVAL);
 			long end = System.currentTimeMillis();
-			addRecord(i, start, end);
+			addRecord(start, end);
 			close();
 			app.stop();
-		}	
+		}
+		
 	}
 }



Mime
View raw message