You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by li...@apache.org on 2012/09/22 13:01:27 UTC

svn commit: r1388768 - in /incubator/ooo/trunk/test: testcommon/source/org/openoffice/test/common/ testcommon/source/org/openoffice/test/vcl/widgets/ testgui/data/pvt/ testgui/source/pvt/gui/ testgui/source/testlib/gui/

Author: liuzhe
Date: Sat Sep 22 11:01:26 2012
New Revision: 1388768

URL: http://svn.apache.org/viewvc?rev=1388768&view=rev
Log:
Update pvt testing files

Added:
    incubator/ooo/trunk/test/testgui/data/pvt/plain_200p.doc   (with props)
    incubator/ooo/trunk/test/testgui/data/pvt/plain_200p.docx   (with props)
    incubator/ooo/trunk/test/testgui/data/pvt/plain_200p.odt   (with props)
Removed:
    incubator/ooo/trunk/test/testgui/source/pvt/gui/Filter.java
    incubator/ooo/trunk/test/testgui/source/pvt/gui/GenerateReports.java
Modified:
    incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/GraphicsUtil.java
    incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/vcl/widgets/VclControl.java
    incubator/ooo/trunk/test/testgui/source/pvt/gui/Benchmark.java
    incubator/ooo/trunk/test/testgui/source/testlib/gui/AppTool.java
    incubator/ooo/trunk/test/testgui/source/testlib/gui/UIMap.java

Modified: incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/GraphicsUtil.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/GraphicsUtil.java?rev=1388768&r1=1388767&r2=1388768&view=diff
==============================================================================
--- incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/GraphicsUtil.java (original)
+++ incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/GraphicsUtil.java Sat Sep 22 11:01:26 2012
@@ -23,8 +23,10 @@
 
 package org.openoffice.test.common;
 
+import java.awt.AWTException;
 import java.awt.Color;
 import java.awt.Graphics;
+import java.awt.Point;
 import java.awt.Rectangle;
 import java.awt.Robot;
 import java.awt.Toolkit;
@@ -53,6 +55,14 @@ public class GraphicsUtil {
 	static final double ERR_RANGLE_ELLIPSE = 1;
 	
 	static Robot robot = null;
+
+	static {
+		try {
+			robot = new Robot();
+		} catch (AWTException e) {
+			e.printStackTrace();
+		}
+	}
 	
 	/**
 	 * Load a image file as buffered image
@@ -106,6 +116,10 @@ public class GraphicsUtil {
 
 	}
 	
+	public static Rectangle getScreenRectangle() {
+		return new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
+	}
+	
 	/**
 	 * Get a BufferedImage including the full current screen shot
 	 * @return
@@ -138,23 +152,12 @@ public class GraphicsUtil {
 	 * @param area
 	 */
 	public static BufferedImage screenshot(String filename, Rectangle area) {
-		// screen capture
-
-		try {
-			if (robot == null)
-				robot = new Robot();
-			
-			if (area == null)
-				area = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
-
-			BufferedImage capture = robot.createScreenCapture(area);
-			if (filename != null)
-				storeImage(capture, filename);
-			return capture;
-		} catch (Exception e) {
-			e.printStackTrace();
-			return null;
-		}
+		if (area == null)
+			area = getScreenRectangle();
+		BufferedImage capture = robot.createScreenCapture(area);
+		if (filename != null)
+			storeImage(capture, filename);
+		return capture;
 	}
 	
 	
@@ -246,4 +249,139 @@ public class GraphicsUtil {
 		return false;
 	}
 	
+	
+	public static Rectangle getBoundingBox(BufferedImage image, int color) {
+		return getBoundingBox(image, color, true);
+	}
+	
+	public static Rectangle getBoundingBox(BufferedImage image, int color, boolean include) {
+		int w = image.getWidth();
+		int h = image.getHeight();
+		int left=w, top=h, right = -1, bottom = -1;
+		for (int i = 0; i < w; i++) {
+			for (int j = 0; j < h; j++) {
+				if ((color == image.getRGB(i, j)) == include) {
+					if (j < top)
+						top = j;
+					if (j > bottom)
+						bottom = j;
+					if (i < left)
+						left = i;
+					if (i > right)
+						right = i;
+				}
+			}
+			
+			
+		}
+		if (right == -1)
+			return null;
+		return new Rectangle(left, top, right - left + 1, bottom - top + 1);
+	}
+	
+	/**
+	 * Check if the rectangle in screen is filled with the given color
+	 * 
+	 * @param color
+	 * @param rect
+	 * @return
+	 */
+	public static boolean isFilledWith(int color, Rectangle rect) {
+		BufferedImage capture = screenshot(rect);
+		int w = capture.getWidth();
+		int h = capture.getHeight();
+		for (int i = 0; i < w; i++) {
+			for (int j = 0; j < h; j++) {
+				if (color != capture.getRGB(i, j))
+					return false;
+			}
+		}
+
+		return true;
+	}
+	
+	/**
+	 * Find a image on the current screen
+	 * @param image
+	 * @param rect
+	 * @return
+	 */
+	public static Point findImage(BufferedImage image, Rectangle rect) {
+		BufferedImage capture = screenshot(rect);
+		int w = capture.getWidth();
+		int h = capture.getHeight();
+		int iw = image.getWidth();
+		int ih = image.getHeight();
+
+		for (int i = 0; i < w; i++) {
+			out: for (int j = 0; j < h; j++) {
+				for (int m = 0; m < iw; m++) {
+					for (int n = 0; n < ih; n++) {
+						if (image.getRGB(m, n) != capture.getRGB(i + m, j + n))
+							continue out;
+					}
+				}
+				return new Point(i, j);
+			}
+		}
+
+		return null;
+	}
+	
+	/**
+	 * Find a color on the current screen
+	 * @param color
+	 * @param rect
+	 * @return
+	 */
+	public static Point findColor(int color, Rectangle rect) {
+		BufferedImage capture = screenshot(rect);
+		int w = capture.getWidth();
+		int h = capture.getHeight();
+		for (int i = 0; i < w; i++) {
+			for (int j = 0; j < h; j++) {
+				if (color == capture.getRGB(i, j))
+					return new Point(i, j);
+			}
+		}
+		return null;
+	}
+	
+	
+	/**
+	 * Check if two BufferedImages equal
+	 * 
+	 * @param expected
+	 * @param actual
+	 * @return
+	 */
+	public static boolean imageEquals(BufferedImage expected, BufferedImage actual) {
+		if (expected == null || actual == null)
+			return false;
+
+		if (expected.getHeight() != actual.getHeight() || expected.getWidth() != actual.getWidth())
+			return false;
+
+		for (int y = 0; y < expected.getHeight(); ++y) {
+			for (int x = 0; x < expected.getWidth(); ++x) {
+				if (expected.getRGB(x, y) != actual.getRGB(x, y))
+					return false;
+			}
+		}
+
+		return true;
+	}
+
+	/**
+	 * Check if two image files equal
+	 * 
+	 * @param expectedImage
+	 * @param actualImage
+	 * @return
+	 */
+	public static boolean imageEquals(String expectedImage, String actualImage) {
+		BufferedImage expected = loadImage(expectedImage), actual = loadImage(actualImage);
+		return imageEquals(expected, actual);
+	}
+
 }

Modified: incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/vcl/widgets/VclControl.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/vcl/widgets/VclControl.java?rev=1388768&r1=1388767&r2=1388768&view=diff
==============================================================================
--- incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/vcl/widgets/VclControl.java (original)
+++ incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/vcl/widgets/VclControl.java Sat Sep 22 11:01:26 2012
@@ -271,8 +271,11 @@ public class VclControl extends VclWidge
 	public boolean exists() {
 		if (!app.exists())
 			return false;
-		
-		return (Boolean) invoke(Constant.M_Exists);
+		try {
+			return (Boolean) invoke(Constant.M_Exists);
+		} catch (Exception e) {
+			return false;
+		}
 	}
 
 	public void focus() {

Added: incubator/ooo/trunk/test/testgui/data/pvt/plain_200p.doc
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testgui/data/pvt/plain_200p.doc?rev=1388768&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/ooo/trunk/test/testgui/data/pvt/plain_200p.doc
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/ooo/trunk/test/testgui/data/pvt/plain_200p.docx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testgui/data/pvt/plain_200p.docx?rev=1388768&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/ooo/trunk/test/testgui/data/pvt/plain_200p.docx
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/ooo/trunk/test/testgui/data/pvt/plain_200p.odt
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testgui/data/pvt/plain_200p.odt?rev=1388768&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/ooo/trunk/test/testgui/data/pvt/plain_200p.odt
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

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=1388768&r1=1388767&r2=1388768&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 22 11:01:26 2012
@@ -25,10 +25,13 @@
 
 package pvt.gui;
 
+import static org.junit.Assert.*;
 import static org.openoffice.test.common.Testspace.*;
 import static org.openoffice.test.vcl.Tester.*;
+import static testlib.gui.AppTool.*;
 import static testlib.gui.UIMap.*;
 
+import java.awt.Rectangle;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.PrintStream;
@@ -36,11 +39,13 @@ import java.util.HashMap;
 
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TestName;
 import org.openoffice.test.OpenOffice;
 import org.openoffice.test.common.Condition;
+import org.openoffice.test.common.GraphicsUtil;
 import org.openoffice.test.common.Logger;
 import org.openoffice.test.common.SystemUtil;
 import org.openoffice.test.common.Testspace;
@@ -63,12 +68,12 @@ public class Benchmark {
 	
 	@BeforeClass
 	public static void beforeClass() throws Exception {
-		File resultFile = Testspace.getFile("output/gui_benchmark.csv");
+		File resultFile = Testspace.getFile("output/pvt_gui_benchmark.csv");
 		resultFile.getParentFile().mkdirs();
 		result = new PrintStream(new FileOutputStream(resultFile));
 		OpenOffice.killAll();
 		
-		result.println("Scenario,Consumed Time,Memory(VSZ),Memory(RSS),Handles(Windows Only)");
+		result.println("Scenario,No,Consumed Time,Memory(VSZ),Memory(RSS),Handles(Windows Only)");
 	}
 	
 	@AfterClass
@@ -85,7 +90,7 @@ public class Benchmark {
 	
 	private void addRecord(int i, long start, long end) {
 		HashMap<String, Object>  perf = getPerfData();
-		result.println(testname.getMethodName() + i + "," + (end - start) + "," + perf.get("vsz") + "," + perf.get("rss") + "," + perf.get("handles"));
+		result.println(testname.getMethodName() + "," + i + "," + (end - start) + "," + perf.get("vsz") + "," + perf.get("rss") + "," + perf.get("handles"));
 	}
 	
 	@Test
@@ -169,125 +174,263 @@ public class Benchmark {
 	}
 	
 	@Test
-	public void loadFinishPlainDoc() {
-		loadFinishTextDocument("pvt_benchmark/sw_plain_120p.doc", "Page 1 / ");
+	public void loadFinishPlainODT() {
+		loadFinish("pvt/plain_200p.odt", "Page 1 / 23[0-9]{1}");
 	}
 	
 	@Test
-	public void loadFinishPlainOdt() {
-		loadFinishTextDocument("pvt_benchmark/sw_plain_120p_odf1.2.odt", "Page 1 / ");
+	public void loadFinishPlainDOC() {
+		loadFinish("pvt/plain_200p.doc", "Page 1 / 23[0-9]{1}");
 	}
 	
 	@Test
-	public void loadFinishComplexDoc() {
-		loadFinishTextDocument("pvt_benchmark/sw_complex_100p.doc", "Page 1 / ");
+	public void loadFinishPlainDOCX() {
+		loadFinish("pvt/plain_200p.docx", "Page 1 / 19[0-9]{1}");
 	}
 	
 	@Test
-	public void loadFinishComplexOdt() {
-		loadFinishTextDocument("pvt_benchmark/sw_complex_100p_odf1.2.odt", "Page 1 / ");
+	public void loadFinishPlainODS() {
+		loadFinish("pvt/plain_11s.ods", "Sheet 1 / 11");
+	}
+	
+	@Test
+	public void loadFinishPlainXLS() {
+		loadFinish("pvt/plain_11s.xls", "Sheet 1 / 11");
+	}
+	
+	@Test
+	public void loadFinishPlainXLSX() {
+		loadFinish("pvt/plain_11s.xlsx", "Sheet 1 / 11");
+	}
+	
+	@Test
+	public void loadFinishPlainODP() {
+		loadFinish("pvt/plain_200p.odp", "Slide 1 / 200");
+	}
+	
+	@Test
+	public void loadFinishPlainPPT() {
+		loadFinish("pvt/plain_200p.ppt", "Slide 1 / 200");
+	}
+	
+	@Test
+	public void loadFinishPlainPPTX() {
+		loadFinish("pvt/plain_200p.pptx", "Slide 1 / 200");
+	}
+	
+	@Test
+	@Ignore
+	public void loadFinishComplexDOC() {
+		loadFinish("pvt/sw_complex_100p.doc", "Page 1 / ");
+	}
+	
+	@Test
+	@Ignore
+	public void loadFinishComplexODT() {
+		loadFinish("pvt/sw_complex_100p_odf1.2.odt", "Page 1 / ");
 	}
 	
-	public void loadFinishTextDocument(String file, final String indicator) {
+	@Test
+	public void loadFinishComplexXLS() {
+		loadFinish("pvt/sc_complex_13sh_4kcell.xls", "Sheet 2 / 13");
+	}
+	
+	@Test
+	public void loadFinishComplexODS() {
+		loadFinish("pvt/sc_complex_13sh_4kcell_new_odf1.2.ods", "Sheet 6 / 13");
+	}
+
+	
+	@Test
+	public void loadFinishComplexODP() {
+		loadFinish("pvt/sd_complex_51p_odf1.2.odp", "Slide 1 / 51");
+	}
+	
+	@Test
+	public void loadFinishComplexPPT() {
+		loadFinish("pvt/sd_complex_51p.ppt", "Slide 1 / 51");
+	}
+	
+	public void loadFinish(String file, final String indicator) {
+		final int openIndicatorIndex = file.matches(".*\\.(odp|ppt|pptx)$") ? 4 : 0;
 		String path = prepareData(file);
 		aoo.kill();
-		aoo.start();
-		startcenter.waitForExistence(120, 1);
+		app.start();
+		startcenter.waitForExistence(10, 1);
+		sleep(2); // Give some seconds to AOO relax. We want data more stable.
 		for (int i = 0; i < 8; i++) {
 			app.dispatch(".uno:Open");
 			filePickerPath.setText(path);
-			filePickerOpen.click();
+			sleep(2);
+			filePickerOpen.click(0.5, 0.5);
 			long start = System.currentTimeMillis();
 			new Condition() {
-	
 				@Override
 				public boolean value() {
-					String text = statusBar.getItemText(0);
-					if (text == null)
+					try {
+						String text = statusBar.getItemText(openIndicatorIndex);
+						return text.matches(indicator);
+					} catch (Exception e) {
 						return false;
-					return text.startsWith(indicator);
+					}
 				}
 				
 			}.waitForTrue("", 120, INTERVAL);
 			long end = System.currentTimeMillis();
 			sleep(2);
 			addRecord(i, start, end);
-			app.dispatch(".uno:CloseDoc");
+			discard();
 		}
 	
 		app.close();
 	}
 	
 	@Test
-	public void loadFinishPlainXLS() {
-		loadFinishTextDocument("pvt_benchmark/sc_plain_4sh_5kcell.xls", "Sheet 2 / 4");
+	public void savePlainDOC() {
+		save("pvt/sw_plain_120p.doc", "Page 1 / ");
 	}
 	
 	@Test
-	public void loadFinishPlainODS() {
-		loadFinishTextDocument("pvt_benchmark/sc_plain_4sh_5kcell_new_odf1.2.ods", "Sheet 1 / 4");
+	public void savePlainODT() {
+		save("pvt/plain_200p.odt", "Page 1 / 23[0-9]{1}");
 	}
 	
 	@Test
-	public void loadFinishComplexXLS() {
-		loadFinishTextDocument("pvt_benchmark/sc_complex_13sh_4kcell.xls", "Sheet 2 / 13");
+	public void saveComplexDOC() {
+		save("pvt/plain_200p.doc", "Page 1 / 23[0-9]{1}");
 	}
 	
 	@Test
-	public void loadFinishComplexODS() {
-		loadFinishTextDocument("pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods", "Sheet 6 / 13");
+	public void saveComplexODT() {
+		save("pvt/sw_complex_100p_odf1.2.odt", "Page 1 / ");
 	}
 	
+	@Test
+	public void savePlainXLS() {
+		save("pvt/plain_11s.xls", "Sheet 1 / 11");
+	}
 	
 	@Test
-	public void loadFinishPlainODP() {
-		loadFinishTextDocument("pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods", "Sheet 6 / 13");
+	public void savePlainODS() {
+		save("pvt/plain_11s.ods", "Sheet 1 / 11");
 	}
 	
 	@Test
-	public void loadFinishPlainPPT() {
-		loadFinishTextDocument("pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods", "Sheet 6 / 13");
+	public void saveComplexXLS() {
+		save("pvt/sc_complex_13sh_4kcell.xls", "Sheet 2 / 13");
 	}
 	
 	@Test
-	public void loadFinishComplexODP() {
-		loadFinishTextDocument("pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods", "Sheet 6 / 13");
+	public void saveComplexODS() {
+		save("pvt/sc_complex_13sh_4kcell_new_odf1.2.ods", "Sheet 6 / 13");
 	}
 	
 	@Test
-	public void loadFinishComplexPPT() {
-		loadFinishTextDocument("pvt_benchmark/sc_complex_13sh_4kcell_new_odf1.2.ods", "Sheet 6 / 13");
+	public void savePlainODP() {
+		save("pvt/plain_200p.odp", "Slide 1 / 200");
 	}
 	
-	public void loadFinish(String file, final String indicator) {
-		String path = prepareData(file);
+	@Test
+	public void savePlainPPT() {
+		save("pvt/plain_200p.ppt", "Slide 1 / 200");
+	}
+	
+	@Test
+	public void saveComplexODP() {
+		save("pvt/sd_complex_51p_odf1.2.odp", "Slide 1 / 51");
+	}
+	
+	@Test
+	public void saveComplexPPT() {
+		save("pvt/sd_complex_51p.ppt", "Slide 1 / 51");
+	}
+	
+	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;
 		aoo.kill();
-		aoo.start();
-		startcenter.waitForExistence(120, 1);
+		app.start();
+		String picture = prepareData("image/red_64x64.bmp");
 		for (int i = 0; i < 8; i++) {
-			app.dispatch(".uno:Open");
-			filePickerPath.setText(path);
-			filePickerOpen.click();
+			String dir = "temp/file" + i;
+			getFile(dir).mkdirs();
+			open(prepareData(file, dir));
+			new Condition() {
+				@Override
+				public boolean value() {
+					try {
+						String text = statusBar.getItemText(openIndicatorIndex);
+						return text.matches(openIndicator);
+					} catch (Exception e) {
+						return false;
+					}
+				}
+				
+			}.waitForTrue("", 120, 1);
+			sleep(2);
+			insertPicture(picture);
+			sleep(3);
+			assertEquals("File is modified", "*", statusBar.getItemText(saveIndicatorIndex));
+			app.dispatch(".uno:Save");
+			if (alienFormat) {
+				alienFormatDlg.waitForExistence(3, 1);
+				sleep(1);
+				typeKeys("<enter>");
+			}
+			
 			long start = System.currentTimeMillis();
 			new Condition() {
-	
 				@Override
 				public boolean value() {
-					String text = statusBar.getItemText(0);
-					if (text == null)
+					try {
+						String text = statusBar.getItemText(saveIndicatorIndex);
+						return " ".equals(text);
+					} catch (Exception e) {
 						return false;
-					return text.startsWith(indicator);
+					}
 				}
 				
 			}.waitForTrue("", 120, INTERVAL);
 			long end = System.currentTimeMillis();
 			sleep(2);
 			addRecord(i, start, end);
-			app.dispatch(".uno:CloseDoc");
+			close();
 		}
 	
 		app.close();
 	}
 
-	
+	@Test
+	public void slideShow() {
+		aoo.kill();
+		app.start();
+		String path = prepareData("pvt/sd_slideshow.odp");
+		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 < 8; i++) {
+			open(path);
+			impress.waitForExistence(60, 1);
+			sleep(2);
+			assertFalse("Slideshow control exists", slideShow.exists());
+			assertFalse("Slideshow is not started", GraphicsUtil.isFilledWith(0xFF00FF00, rect));
+			typeKeys("<F5>");
+			long start = System.currentTimeMillis();
+			new Condition() {
+				@Override
+				public boolean value() {
+					return GraphicsUtil.isFilledWith(0xFF00FF00, rect);
+				}
+				
+			}.waitForTrue("", 120, INTERVAL);
+			long end = System.currentTimeMillis();
+			sleep(2);
+			addRecord(i, start, end);
+			slideShow.typeKeys("<esc>");
+			sleep(2);
+			close();
+		}
+		app.close();
+	}
 }

Modified: incubator/ooo/trunk/test/testgui/source/testlib/gui/AppTool.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testgui/source/testlib/gui/AppTool.java?rev=1388768&r1=1388767&r2=1388768&view=diff
==============================================================================
--- incubator/ooo/trunk/test/testgui/source/testlib/gui/AppTool.java (original)
+++ incubator/ooo/trunk/test/testgui/source/testlib/gui/AppTool.java Sat Sep 22 11:01:26 2012
@@ -22,8 +22,6 @@
 package testlib.gui;
 
 import static org.openoffice.test.common.Testspace.*;
-import static org.openoffice.test.vcl.Tester.*;
-import static testlib.gui.AppTool.*;
 import static testlib.gui.UIMap.*;
 
 import org.openoffice.test.common.Condition;
@@ -119,12 +117,12 @@ public class AppTool extends Tester {
 	public static void openStartcenter() {
 		if (startcenter.exists())
 			return;
-
+	
 		if (SystemUtil.isMac()) {
 			SystemUtil.execScript("osascript -e 'tell app \"OpenOffice.org\" to activate'");
 			typeKeys("<command n>");
 		}
-
+	
 	}
 
 	public static String copyAll() {
@@ -141,14 +139,11 @@ public class AppTool extends Tester {
 	public static void submitOpenDlg(String path) {
 		filePickerPath.setText(path);
 		filePickerOpen.click();
-		sleep(1);
 	}
 
 	public static void submitSaveDlg(String path) {
 		fileSavePath.setText(path);
-
 		String extName = FileUtil.getFileExtName(path).toLowerCase();
-
 		String[] filters = fileSaveFileType.getItemsText();
 		int i = 0;
 		for (; i < filters.length; i++) {
@@ -164,7 +159,6 @@ public class AppTool extends Tester {
 
 		fileSaveFileType.select(i);
 		fileSaveSave.click();
-		sleep(1);
 	}
 
 	public static void submitSaveDlg(String path, String ext) {
@@ -185,7 +179,6 @@ public class AppTool extends Tester {
 				throw new RuntimeException("Can't find the supported doc format!");
 		}
 		fileSaveFileType.click();
-		sleep(1);
 	}
 
 	public static void handleBlocker(final VclWindow... windows) {
@@ -231,4 +224,9 @@ public class AppTool extends Tester {
 
 		}.waitForTrue("Time out wait window to be active.", 120, 2);
 	}
+	
+	public static void insertPicture(String path) {
+		app.dispatch(".uno:InsertGraphic");
+		submitOpenDlg(getPath(path));
+	}
 }

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=1388768&r1=1388767&r2=1388768&view=diff
==============================================================================
--- incubator/ooo/trunk/test/testgui/source/testlib/gui/UIMap.java (original)
+++ incubator/ooo/trunk/test/testgui/source/testlib/gui/UIMap.java Sat Sep 22 11:01:26 2012
@@ -539,4 +539,5 @@ public class UIMap {
 	public static final VclTreeListBox runMacroDlgCategories = tree("CUI_HID_SELECTOR_CATEGORIES");
 	public static final VclTreeListBox runMacroDlgCommands = tree("CUI_HID_SELECTOR_COMMANDS");
 	
+	public static final VclButton standardBarSave = button(".uno:Save");
 }