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/08/30 11:27:23 UTC
svn commit: r1378870 [1/6] - in /incubator/ooo/trunk/main/test: ./ inc/ prj/
source/ testcommon/ testcommon/source/org/openoffice/test/common/
testgui/source/testcase/gui/ testgui/source/testcase/gui/bvt/
testgui/source/testcase/gui/formula/catalog/ te...
Author: liuzhe
Date: Thu Aug 30 09:27:21 2012
New Revision: 1378870
URL: http://svn.apache.org/viewvc?rev=1378870&view=rev
Log:
Updates for Enabling Daily Testing
Added:
incubator/ooo/trunk/main/test/build.example.properties
incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/common/Logger.java
- copied, changed from r1377554, incubator/ooo/trunk/main/test/testgui/source/testlib/gui/Log.java
Removed:
incubator/ooo/trunk/main/test/inc/
incubator/ooo/trunk/main/test/prj/
incubator/ooo/trunk/main/test/source/
incubator/ooo/trunk/main/test/testgui/source/testlib/gui/Log.java
Modified:
incubator/ooo/trunk/main/test/build.xml
incubator/ooo/trunk/main/test/testcommon/.classpath
incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/common/Testspace.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/AOOTest.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/TestSample.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/bvt/BasicFunctionTest.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/bvt/FileTypeTest.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/bvt/SmokeTest.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/formula/catalog/AddDeleteSymbolsFromCatalog.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/formula/catalog/InputCharacterFromCatalogDlg.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/formula/importexport/CreateFormulaInDifferentWays.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/Filter.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/performance/benchmark/GenerateReports.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/cell/InserCells.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/chart/ChartDialogSetting.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/datapilot/DataPivotTable.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/filter/Fitler.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/rowcolumn/InsertRowAndColumn.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/sheet/InsertSheet.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/sort/SortDialogSetting.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/subtotals/SubtotalsFunctions.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/validity/ValidityDateSupport1024Columns.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/validity/ValidityDialogDefaultValue.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/validity/ValidityDialogSetting.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sc/validity/ValiditySampleFile.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sd/headerandfooter/HeaderAndFooterSetting.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sd/headerandfooter/OpenDocumentWithHeaderFooter.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sd/table/ChangeTableBackgroundProperty.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sd/table/ChangeTableBorderProperty.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sd/table/ChangeTableFontEffectsProperty.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/LongRun.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sc/OperationOnNewSC.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sc/OperationOnSampleFile.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sd/OperationOnNewSD.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnNewSW.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnSample1.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/svt/sw/OperationOnSample2.java
incubator/ooo/trunk/main/test/testgui/source/testcase/gui/sw/table/Table.java
incubator/ooo/trunk/main/test/testgui/source/testlib/gui/AppUtil.java
incubator/ooo/trunk/main/test/testgui/source/testlib/gui/CalcUtil.java
incubator/ooo/trunk/main/test/testgui/source/testlib/gui/ImpressUtil.java
incubator/ooo/trunk/main/test/testgui/source/testlib/gui/UIMap.java
incubator/ooo/trunk/main/test/testgui/source/testsuite/gui/TestSampleAsMS2003.java
incubator/ooo/trunk/main/test/testgui/source/testsuite/gui/TestSampleAsOriginal.java
Added: incubator/ooo/trunk/main/test/build.example.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/build.example.properties?rev=1378870&view=auto
==============================================================================
--- incubator/ooo/trunk/main/test/build.example.properties (added)
+++ incubator/ooo/trunk/main/test/build.example.properties Thu Aug 30 09:27:21 2012
@@ -0,0 +1,4 @@
+#test.classes=testcase/uno/sc/cell/**/*.class
+openoffice.build.url=ftp://www.openoffice.org/daily/Aoo_Trunk/LatestBuild.txt
+openoffice.archive.url=ftp://www.openoffice.org/daily/Aoo_Trunk/${openoffice.build}/Apache_OpenOffice_incubating_3.5.0_MacOS_x86_install-arc_en-US.tar.gz
+report.repos=test:test@report.server:/var/www/test/trunk
\ No newline at end of file
Modified: incubator/ooo/trunk/main/test/build.xml
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/build.xml?rev=1378870&r1=1378869&r2=1378870&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/build.xml (original)
+++ incubator/ooo/trunk/main/test/build.xml Thu Aug 30 09:27:21 2012
@@ -32,7 +32,7 @@
<property name="junit.home" value="${env.JUNIT_HOME}" />
<property name="testspace" value="${env.TESTSPACE}" />
<property name="classes" value="${testspace}/class" />
- <property name="dist" value="${testspace}/dist" />
+ <property name="dist" value="." />
<property name="test.classes" value="testcase/gui/bvt/*.class" />
<property name="test.output" value="${testspace}/output" />
<property name="test.result" value="${test.output}/result" />
@@ -54,9 +54,12 @@
</copy>
</target>
- <target name="testcommon.compile" depends="testcommon.init">
+ <target name="testcommon.compile" depends="testcommon.init, prepare.junit">
<javac destdir="${classes}" debug="on" source="1.6" includeantruntime="false">
<src path="testcommon/source"/>
+ <classpath>
+ <path refid="junit.classpath"/>
+ </classpath>
</javac>
</target>
@@ -94,7 +97,7 @@
</copy>
</target>
- <target name="testuno.compile" depends="testuno.init, prepare.junit">
+ <target name="testuno.compile" depends="testuno.init">
<path id="uno.classpath">
<fileset dir="${openoffice.home}" erroronmissingdir="false">
<include name="**/juh.jar" />
@@ -132,9 +135,11 @@
<target name="compile" depends="testcommon.init, testcommon.compile, testgui.init, testgui.compile, testuno.init, testuno.compile" description="Compile source code">
</target>
- <target name="dist" depends="compile">
+ <target name="dist">
<tstamp />
<property name="dist.archive" value="aoo_test_${DSTAMP}.zip" />
+ <zip destfile="${dist}/${dist.archive}" basedir="." update="true" includes="testcommon/**,testgui/**,testuno/**,build.xml,build.example.properties,external/**,reportstyle/**" excludes="**/bin/**">
+ </zip>
</target>
<target name="check.build" description="Check the build context">
Modified: incubator/ooo/trunk/main/test/testcommon/.classpath
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/.classpath?rev=1378870&r1=1378869&r2=1378870&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/.classpath (original)
+++ incubator/ooo/trunk/main/test/testcommon/.classpath Thu Aug 30 09:27:21 2012
@@ -2,5 +2,6 @@
<classpath>
<classpathentry kind="src" path="source"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Copied: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/common/Logger.java (from r1377554, incubator/ooo/trunk/main/test/testgui/source/testlib/gui/Log.java)
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/common/Logger.java?p2=incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/common/Logger.java&p1=incubator/ooo/trunk/main/test/testgui/source/testlib/gui/Log.java&r1=1377554&r2=1378870&rev=1378870&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/source/testlib/gui/Log.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/common/Logger.java Thu Aug 30 09:27:21 2012
@@ -19,84 +19,148 @@
*
*************************************************************/
-package testlib.gui;
+package org.openoffice.test.common;
+import java.io.ByteArrayInputStream;
import java.io.File;
-import java.io.IOException;
-import java.util.logging.FileHandler;
+import java.io.InputStream;
import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.logging.SimpleFormatter;
+import java.util.logging.LogManager;
-import org.junit.rules.TestWatcher;
+import org.junit.internal.AssumptionViolatedException;
+import org.junit.rules.TestRule;
import org.junit.runner.Description;
-import org.openoffice.test.OpenOffice;
-import org.openoffice.test.common.GraphicsUtil;
-import org.openoffice.test.common.Testspace;
-import org.openoffice.test.vcl.client.CommunicationException;
-
-/**
- * The class is used to capture extra information during the testing, including
- * 1. Take a screenshot when testing is failed. 2. Collect data as the clue when
- * oo crashes.
- *
- */
-public class Log extends TestWatcher {
- static File screenshotOutput = null;
- static File logOutput = null;
- static Logger logger;
- static {
- screenshotOutput = Testspace.getFile("output/screenshot");
- screenshotOutput.mkdirs();
+import org.junit.runners.model.Statement;
+
- logOutput = Testspace.getFile("output/logs");
- logOutput.mkdirs();
+public class Logger extends java.util.logging.Logger implements TestRule {
+ private static final String SCREENSHOT_DIR = "output/screenshot";
+
+ private static String curClassName;
+
+ private boolean screenshotEnabled = true;
+
+ static {
+ File logDir = Testspace.getFile("log");
+ logDir.mkdirs();
+ String loggingProperties =
+ "java.util.logging.ConsoleHandler.level=INFO\n"
+ + "java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter\n"
+ + "java.util.logging.FileHandler.level=INFO\n"
+ + "java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter\n"
+ + "java.util.logging.FileHandler.limit=1024000\n"
+ + "java.util.logging.FileHandler.count=1\n"
+ + "java.util.logging.FileHandler.pattern=" + logDir.getAbsolutePath().replace("\\", "/") + "/%u.log\n"
+ + "java.util.logging.FileHandler.append=true\n"
+ + "handlers= java.util.logging.ConsoleHandler,java.util.logging.FileHandler ";
+ InputStream inputStream = new ByteArrayInputStream(loggingProperties.getBytes());
+ LogManager logManager = LogManager.getLogManager();
try {
- logger = Logger.getLogger("vclauto");
- FileHandler fh = new FileHandler(logOutput.getAbsolutePath() + "/" + "%u.log", true);
- logger.addHandler(fh);
- logger.setLevel(Level.ALL);
- SimpleFormatter sf = new SimpleFormatter();
- fh.setFormatter(sf);
- // ConsoleHandler ch = new ConsoleHandler();
- // logger.addHandler(ch);
- // logger.setLevel(Level.ALL);
- // ch.setFormatter(sf);
- } catch (IOException e) {
- // ignore;
+ logManager.readConfiguration(inputStream);
+ } catch (Exception e) {
+ // ignore
}
+
}
- @Override
- protected void starting(Description description) {
- logger.info("Start " + description);
- super.starting(description);
+ private Logger(String name) {
+ super(name, null);
}
- @Override
- protected void failed(Throwable e, Description description) {
- super.failed(e, description);
- String screenshotType = null;
- if (e instanceof AssertionError) {
- screenshotType = "failure";
- } else {
- screenshotType = "error";
+ public static Logger getLogger(Object obj, boolean screenshotEnabled) {
+ Logger logger = getLogger(obj);
+ logger.setScreenshotEnabled(screenshotEnabled);
+ return logger;
+ }
+
+ public static Logger getLogger(String name, boolean screenshotEnabled) {
+ Logger logger = getLogger(name);
+ logger.setScreenshotEnabled(screenshotEnabled);
+ return logger;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public static Logger getLogger(Object obj) {
+ if (obj == null)
+ return getLogger("global");
+ return getLogger(obj instanceof Class ? ((Class) obj).getName() : obj.getClass().getName());
+ }
+
+ public static synchronized Logger getLogger(String name) {
+ LogManager manager = LogManager.getLogManager();
+ Logger result = (Logger) manager.getLogger(name);
+ if (result == null) {
+ result = new Logger(name);
+ manager.addLogger(result);
+ result = (Logger) manager.getLogger(name);
}
+ return result;
+ }
+
+ protected void start(Description description) {
+ if (!description.getClassName().equals(curClassName)) {
+ curClassName = description.getClassName();
+ log(Level.INFO, "Start running test class [" + curClassName + "]");
+ File temp = Testspace.getFile("classtemp");
+ FileUtil.deleteFile(temp);
+ log(Level.INFO, "Clean up temp directory for test class [" + temp.getAbsolutePath() + "]");
+ temp.mkdirs();
+ }
+ log(Level.INFO, "Start running test method [" + description.getMethodName() + "]");
+ File temp = Testspace.getFile("temp");
+ FileUtil.deleteFile(temp);
+ log(Level.INFO, "Clean up temp directory for test method [" + temp.getAbsolutePath() + "]");
+ temp.mkdirs();
+ }
+ protected void fail(Throwable e, Description description) {
+ String screenshotType = e instanceof AssertionError ? "failure" : "error";
+ File screenshotOutput = Testspace.getFile(SCREENSHOT_DIR);
+ screenshotOutput.mkdirs();
File file = new File(screenshotOutput, description.getClassName() + "." + description.getMethodName() + "." + screenshotType + ".png");
GraphicsUtil.screenShot(file.getAbsolutePath());
- logger.log(Level.SEVERE, "Testing is failed. Screenshot: " + file.getAbsolutePath(), e);
+ log(Level.SEVERE, "[" + description.getMethodName() + "] is failed. Screenshot [" + file.getAbsolutePath() + "]. Cause: ", e);
// Check if crash occurs!
- if (e instanceof CommunicationException) {
- logger.severe("Pay attention! OpenOffice maybe crashed or freezed. ");
- // If testcase is failed, kill AOO to avoid impacting the following
- // test cases.
- OpenOffice.killAll();
- }
+ // if (e instanceof CommunicationException) {
+ // logger.severe("Pay attention! OpenOffice maybe crashed or freezed. ");
+ // // If testcase is failed, kill AOO to avoid impacting the following
+ // // test cases.
+ // OpenOffice.killAll();
+ // }
+
+ }
+
+ public boolean isScreenshotEnabled() {
+ return screenshotEnabled;
+ }
+ public void setScreenshotEnabled(boolean screenshotEnabled) {
+ this.screenshotEnabled = screenshotEnabled;
}
- public void info(String message) {
- logger.info(message);
+ private void finish(Description description) {
+ log(Level.INFO, "Finish running test method [" + description.getMethodName() + "]");
+ }
+
+ @Override
+ public Statement apply(final Statement base, final Description description) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ start(description);
+ try {
+ base.evaluate();
+ // succeeded(description);
+ } catch (AssumptionViolatedException e) {
+ throw e;
+ } catch (Throwable t) {
+ fail(t, description);
+ throw t;
+ } finally {
+ finish(description);
+ }
+ }
+ };
+
}
}
Modified: incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/common/Testspace.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/common/Testspace.java?rev=1378870&r1=1378869&r2=1378870&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/common/Testspace.java (original)
+++ incubator/ooo/trunk/main/test/testcommon/source/org/openoffice/test/common/Testspace.java Thu Aug 30 09:27:21 2012
@@ -32,10 +32,23 @@ import java.io.InputStream;
*/
public class Testspace {
- private static final File testspace = new File(System.getProperty("testspace", "../testspace"));
+ private static final File testspace = initTestspace();
private static final File testdata = new File(System.getProperty("testdata", "data"));
+ private static File initTestspace() {
+ String v = System.getProperty("testspace");
+ File file = null;
+ if (v == null) {
+ file = new File("../testspace");
+ System.setProperty("testspace", file.getAbsolutePath());
+ } else {
+ file = new File(v);
+ }
+
+ return file;
+ }
+
public static String getPath() {
return testspace.getAbsolutePath();
}
@@ -61,7 +74,7 @@ public class Testspace {
}
public static String prepareData(String dataFilePath) {
- return prepareData(dataFilePath, "data/" + dataFilePath);
+ return prepareData(dataFilePath, "temp/" + dataFilePath);
}
public static String prepareData(String dataFilePath, String to) {
Modified: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/AOOTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/AOOTest.java?rev=1378870&r1=1378869&r2=1378870&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/AOOTest.java (original)
+++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/AOOTest.java Thu Aug 30 09:27:21 2012
@@ -19,8 +19,6 @@
*
*************************************************************/
-
-
package testcase.gui;
import static org.junit.Assert.*;
@@ -31,48 +29,49 @@ import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
+import org.openoffice.test.common.Logger;
import testlib.gui.CalcUtil;
-import testlib.gui.Log;
/**
- * If AOO is not installed in the default directory, please specify the system property in your command line. <br/>
- * -Dopenoffice.home="Your OpenOffice installation directory which contains soffice.bin"
- *
+ * If AOO is not installed in the default directory, please specify the system
+ * property in your command line. <br/>
+ * -Dopenoffice.home=
+ * "Your OpenOffice installation directory which contains soffice.bin"
+ *
*/
public class AOOTest {
/**
- * Add Log to enable the following capabilities.
- * 1. Take a screenshot when failure occurs.
- * 2. Collect extra data when OpenOffice crashes.
- * 3. Log any detail information.
+ * Add Log to enable the following capabilities. 1. Take a screenshot when
+ * failure occurs. 2. Log any detail information.
*/
@Rule
- public Log LOG = new Log();
+ public Logger log = Logger.getLogger(this);
-
/**
* Do some setup task before running test
+ *
* @throws Exception
*/
@Before
public void setUp() throws Exception {
- //Start OpenOffice with a clean user profile
- app.start(true);
+ // Start OpenOffice with a clean user profile
+ app.start(true);
}
/**
* Clean task after testing
+ *
* @throws Exception
*/
@After
public void tearDown() throws Exception {
-
+
}
-
+
/**
- * Implement test steps
+ * Implement test steps
*/
@Test
public void testHello() {
Modified: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/TestSample.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/TestSample.java?rev=1378870&r1=1378869&r2=1378870&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/TestSample.java (original)
+++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/TestSample.java Thu Aug 30 09:27:21 2012
@@ -19,8 +19,6 @@
*
*************************************************************/
-
-
package testcase.gui;
import static org.openoffice.test.common.Testspace.*;
@@ -43,21 +41,19 @@ import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import org.openoffice.test.common.Condition;
import org.openoffice.test.common.FileUtil;
+import org.openoffice.test.common.Logger;
import testlib.gui.ImpressUtil;
-import testlib.gui.Log;
-
@RunWith(Parameterized.class)
public class TestSample {
-
+
public static String repos = "samples";
-
+
public static String[][] params = {};
-
-
+
@Parameters
- public static Collection<Object[]> data() {
+ public static Collection<Object[]> data() {
File dir = new File(repos);
ArrayList<Object[]> list = new ArrayList<Object[]>();
collect(dir, list);
@@ -69,63 +65,70 @@ public class TestSample {
* @param dir
* @param list
*/
- public static void collect(File dir, ArrayList<Object[]> list) {
- File[] files = dir.listFiles();
- if (files == null)
- return;
-
- for (File file : files) {
- if (file.isDirectory()) {
- collect(file, list);
- } else {
- String fileName = file.getName().toLowerCase();
- for (String[] param : params) {
- String filter = param[0];
- if (filter != null && fileName.matches(filter)) {
- Object[] data = {file, param[1], param[2]};
- list.add(data);
- System.out.println(file + param[1] + param[2]);
- break;
- }
- }
- }
- }
- }
+ public static void collect(File dir, ArrayList<Object[]> list) {
+ File[] files = dir.listFiles();
+ if (files == null)
+ return;
+
+ for (File file : files) {
+ if (file.isDirectory()) {
+ collect(file, list);
+ } else {
+ String fileName = file.getName().toLowerCase();
+ for (String[] param : params) {
+ String filter = param[0];
+ if (filter != null && fileName.matches(filter)) {
+ Object[] data = { file, param[1], param[2] };
+ list.add(data);
+ System.out.println(file + param[1] + param[2]);
+ break;
+ }
+ }
+ }
+ }
+ }
private static final String writerFilter = ".*\\.((odt)|(ott)|(sxw)|(stw)|(doc)|(dot)|(docx)|(docm)|(dotx)|(dotm))$";
private static final String calcFilter = ".*\\.((ods)|(ots)|(sxc)|(stc)|(xls)|(xlt)|(xlsx)|(xltx)|(xlsm)|(xltm))$";
private static final String impressFilter = ".*\\.((odp)|(otp)|(sxi)|(sti)|(ppt)|(pot)|(pptx)|(pptm)|(potm)|(potx))$";
private static final String drawFilter = ".*\\.((odg)|(otg)|(sxd)|(sxt))$";
private static final String databaseFilter = ".*\\.(odb)$";
-
+
@Rule
- public static Log LOG = new Log();
+ public Logger log = Logger.getLogger(this);
private File originalFile = null;
private String saveas = null;
private String editor = null;
private File file = null;
private String saveTo = null;
private boolean passed = false;
+
public TestSample(File file, String saveas, String editor) {
this.originalFile = file;
this.saveas = saveas;
this.editor = editor;
}
-
+
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() {
app.start();
-
+
FileUtil.deleteFile(getPath("temp"));
File temp = new File(getPath("temp"));
temp.mkdirs();
- LOG.info("Load sample file from \"" + originalFile.getAbsolutePath() + "\"");
- file = new File(temp + "/origin", "sample." + FileUtil.getFileExtName(originalFile.getName()) /*file.getName()*/);
+ log.info("Load sample file from \"" + originalFile.getAbsolutePath() + "\"");
+ file = new File(temp + "/origin", "sample." + FileUtil.getFileExtName(originalFile.getName()) /*
+ * file
+ * .
+ * getName
+ * (
+ * )
+ */);
FileUtil.copyFile(originalFile, file); // We use the copy to do test
- saveTo = getPath("temp/" + file.getName() + (saveas == null ? "": "." + saveas));
+ saveTo = getPath("temp/" + file.getName() + (saveas == null ? "" : "." + saveas));
}
@After
@@ -136,7 +139,7 @@ public class TestSample {
FileUtil.copyFile(originalFile, new File(failedDir, originalFile.getName()));
}
}
-
+
@Test
public void test() {
if (editor == null) {
@@ -148,9 +151,9 @@ public class TestSample {
} else if (name.matches(impressFilter)) {
testImpress();
} else if (name.matches(drawFilter)) {
-
+
} else if (name.matches(databaseFilter)) {
-
+
} else {
Assert.assertTrue("It's supported", false);
}
@@ -167,17 +170,15 @@ public class TestSample {
testDatabase();
}
}
-
-
private void testDatabase() {
// TODO Auto-generated method stub
-
+
}
private void testDraw() {
// TODO Auto-generated method stub
-
+
}
public void testWriter() {
@@ -185,26 +186,28 @@ public class TestSample {
submitOpenDlg(file.getAbsolutePath());
handleBlocker(writer);
sleep(10);
-
-// Assert.assertTrue("File Passed:" + file, writer.getCaption().contains(file.getName()));
-
+
+ // Assert.assertTrue("File Passed:" + file,
+ // writer.getCaption().contains(file.getName()));
+
writer.menuItem("File->Save As...").select();
- submitSaveDlg(saveTo);
+ submitSaveDlg(saveTo);
if (AlienFormatDlg.exists(3))
AlienFormatDlg.ok();
sleep(2);
writer.waitForEnabled(120, 2);
-
+
writer.menuItem("File->Close").select();
-
+
openStartcenter();
// Reopen the saved file
startcenter.menuItem("File->Open...").select();
submitOpenDlg(saveTo);
handleBlocker(writer);
sleep(10);
-
-// Assert.assertTrue("File Passed:" + file, writer.getCaption().contains(file.getName()));
+
+ // Assert.assertTrue("File Passed:" + file,
+ // writer.getCaption().contains(file.getName()));
writer.menuItem("File->Close").select();
passed = true;
}
@@ -214,11 +217,12 @@ public class TestSample {
submitOpenDlg(file.getAbsolutePath());
handleBlocker(calc);
sleep(10); // Wait. Crash maybe occurs when the file is shown!
-
-// Assert.assertTrue("File Passed:" + file, calc.getCaption().contains(file.getName()));
-
+
+ // Assert.assertTrue("File Passed:" + file,
+ // calc.getCaption().contains(file.getName()));
+
calc.menuItem("File->Save As...").select();
- submitSaveDlg(saveTo);
+ submitSaveDlg(saveTo);
if (AlienFormatDlg.exists(3))
AlienFormatDlg.ok();
sleep(2);
@@ -231,9 +235,8 @@ public class TestSample {
}
return calc.isEnabled();
}
-
- }.waitForTrue("Time out to wait the control to be enabled!", 120, 2);
+ }.waitForTrue("Time out to wait the control to be enabled!", 120, 2);
calc.menuItem("File->Close").select();
openStartcenter();
@@ -242,23 +245,25 @@ public class TestSample {
submitOpenDlg(saveTo);
handleBlocker(calc);
sleep(10);
-
-// Assert.assertTrue("File Passed:" + file, calc.getCaption().contains(file.getName()));
+
+ // Assert.assertTrue("File Passed:" + file,
+ // calc.getCaption().contains(file.getName()));
calc.menuItem("File->Close").select();
passed = true;
}
-
+
public void testImpress() {
startcenter.menuItem("File->Open...").select();
submitOpenDlg(file.getAbsolutePath());
handleBlocker(impress, ImpressSlideSorter, ImpressOutline, ImpressHandout);
sleep(10); // Wait. Crash maybe occurs when the file is shown!
ImpressUtil.getCurView().menuItem("View->Normal").select();
-
-// Assert.assertTrue("File Passed:" + file, impress.getCaption().contains(file.getName()));
-
+
+ // Assert.assertTrue("File Passed:" + file,
+ // impress.getCaption().contains(file.getName()));
+
impress.menuItem("File->Save As...").select();
- submitSaveDlg(saveTo);
+ submitSaveDlg(saveTo);
if (AlienFormatDlg.exists(3))
AlienFormatDlg.ok();
sleep(2);
@@ -269,9 +274,10 @@ public class TestSample {
startcenter.menuItem("File->Open...").select();
submitOpenDlg(saveTo);
handleBlocker(impress);
- sleep(10); // Wait.
-
-// Assert.assertTrue("File Passed:" + file, impress.getCaption().contains(file.getName()));
+ sleep(10); // Wait.
+
+ // Assert.assertTrue("File Passed:" + file,
+ // impress.getCaption().contains(file.getName()));
impress.menuItem("File->Close").select();
passed = true;
}
Modified: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/bvt/BasicFunctionTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/bvt/BasicFunctionTest.java?rev=1378870&r1=1378869&r2=1378870&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/bvt/BasicFunctionTest.java (original)
+++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/bvt/BasicFunctionTest.java Thu Aug 30 09:27:21 2012
@@ -24,68 +24,11 @@
*/
package testcase.gui.bvt;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.openoffice.test.common.Testspace.getPath;
-import static org.openoffice.test.common.Testspace.prepareData;
-import static org.openoffice.test.vcl.Tester.sleep;
-import static testlib.gui.AppUtil.submitOpenDlg;
-import static testlib.gui.AppUtil.submitSaveDlg;
-import static testlib.gui.AppUtil.typeKeys;
-import static testlib.gui.UIMap.AboutDialog;
-import static testlib.gui.UIMap.Chart_Wizard;
-import static testlib.gui.UIMap.FileSave;
-import static testlib.gui.UIMap.FileSave_FileType;
-import static testlib.gui.UIMap.File_PrintDlg;
-import static testlib.gui.UIMap.FillSeriesDlg;
-import static testlib.gui.UIMap.FindDlg;
-import static testlib.gui.UIMap.FindDlg_Find;
-import static testlib.gui.UIMap.FindDlg_FindAll;
-import static testlib.gui.UIMap.FindDlg_For;
-import static testlib.gui.UIMap.FindDlg_ReplaceAll;
-import static testlib.gui.UIMap.FindDlg_ReplaceWith;
-import static testlib.gui.UIMap.InsertTable;
-import static testlib.gui.UIMap.MacroDialogsPage;
-import static testlib.gui.UIMap.PDFGeneralPage;
-import static testlib.gui.UIMap.PresentationWizard;
-import static testlib.gui.UIMap.SC_FunctionWizardDlg;
-import static testlib.gui.UIMap.SC_FunctionWizardDlg_Edit1;
-import static testlib.gui.UIMap.SC_FunctionWizardDlg_FunctionList;
-import static testlib.gui.UIMap.SC_FunctionWizardDlg_Next;
-import static testlib.gui.UIMap.SC_InputBar_Input;
-import static testlib.gui.UIMap.SC_InputBar_Sum;
-import static testlib.gui.UIMap.SlideShow;
-import static testlib.gui.UIMap.SortOptionsPage;
-import static testlib.gui.UIMap.SortOptionsPage_CustomSortOrder;
-import static testlib.gui.UIMap.SortOptionsPage_CustomSortOrderList;
-import static testlib.gui.UIMap.SortOptionsPage_RangeContainsColumnLabels;
-import static testlib.gui.UIMap.SortPage;
-import static testlib.gui.UIMap.SortPage_Ascending3;
-import static testlib.gui.UIMap.SortPage_By1;
-import static testlib.gui.UIMap.SortPage_By2;
-import static testlib.gui.UIMap.SortPage_By3;
-import static testlib.gui.UIMap.SortPage_Descending1;
-import static testlib.gui.UIMap.SortPage_Descending2;
-import static testlib.gui.UIMap.SortPage_Descending3;
-import static testlib.gui.UIMap.SortWarningDlg_Current;
-import static testlib.gui.UIMap.Table_Toolbar;
-import static testlib.gui.UIMap.Wizards_AgendaDialog;
-import static testlib.gui.UIMap.Wizards_AgendaDialog_FinishButton;
-import static testlib.gui.UIMap.app;
-import static testlib.gui.UIMap.button;
-import static testlib.gui.UIMap.calc;
-import static testlib.gui.UIMap.chart;
-import static testlib.gui.UIMap.draw;
-import static testlib.gui.UIMap.impress;
-import static testlib.gui.UIMap.msgbox;
-import static testlib.gui.UIMap.oo;
-import static testlib.gui.UIMap.toolbox;
-import static testlib.gui.UIMap.writer;
-import static testlib.gui.UIMap.writer_InsertTable;
+import static org.junit.Assert.*;
+import static org.openoffice.test.common.Testspace.*;
+import static org.openoffice.test.vcl.Tester.*;
+import static testlib.gui.AppUtil.*;
+import static testlib.gui.UIMap.*;
import java.awt.Rectangle;
import java.io.File;
@@ -96,9 +39,9 @@ import org.junit.Rule;
import org.junit.Test;
import org.openoffice.test.common.FileUtil;
import org.openoffice.test.common.GraphicsUtil;
+import org.openoffice.test.common.Logger;
import testlib.gui.CalcUtil;
-import testlib.gui.Log;
/**
*
@@ -106,7 +49,7 @@ import testlib.gui.Log;
public class BasicFunctionTest {
@Rule
- public Log LOG = new Log();
+ public Logger log = Logger.getLogger(this);
@Before
public void setUp() throws Exception {
@@ -133,8 +76,7 @@ public class BasicFunctionTest {
assertTrue("PDF is exported?", new File(exportTo).exists());
assertTrue(toolbox(".HelpId:standardbar").exists(5));
button(".uno:ExportDirectToPDF").click();
- assertEquals("PDF - Portable Document Format (.pdf)",
- FileSave_FileType.getSelText());
+ assertEquals("PDF - Portable Document Format (.pdf)", FileSave_FileType.getSelText());
FileSave.cancel();
}
@@ -162,8 +104,7 @@ public class BasicFunctionTest {
// Create a new text document and launch a Wizards dialog which need JVM
// work correctly.
app.dispatch("private:factory/swriter");
- File tempfile = new File(oo.getUserInstallation(),
- "user/template/myAgendaTemplate.ott");
+ File tempfile = new File(oo.getUserInstallation(), "user/template/myAgendaTemplate.ott");
FileUtil.deleteFile(tempfile);
sleep(3);
app.dispatch("service:com.sun.star.wizards.agenda.CallWizard?start");
@@ -226,8 +167,7 @@ public class BasicFunctionTest {
sleep(1);
// Verify if the picture is inserted successfully
- Rectangle rectangle = GraphicsUtil.findRectangle(
- writer.getScreenRectangle(), 0xFF00FF00);
+ Rectangle rectangle = GraphicsUtil.findRectangle(writer.getScreenRectangle(), 0xFF00FF00);
assertNotNull("Green rectangle: " + rectangle, rectangle);
@@ -238,8 +178,7 @@ public class BasicFunctionTest {
writer.click(0.5, 0.5);
sleep(1);
// Verify if the picture is inserted successfully
- rectangle = GraphicsUtil.findRectangle(writer.getScreenRectangle(),
- 0xFFFF0000);
+ rectangle = GraphicsUtil.findRectangle(writer.getScreenRectangle(), 0xFFFF0000);
assertNotNull("Red rectangle: " + rectangle, rectangle);
}
@@ -260,8 +199,7 @@ public class BasicFunctionTest {
sleep(1);
// Verify if the picture is inserted successfully
- Rectangle rectangle = GraphicsUtil.findRectangle(
- calc.getScreenRectangle(), 0xFF00FF00);
+ Rectangle rectangle = GraphicsUtil.findRectangle(calc.getScreenRectangle(), 0xFF00FF00);
assertNotNull("Green rectangle: " + rectangle, rectangle);
// assertEquals(new Rectangle(0,0,64,64), rectangle);
@@ -273,8 +211,7 @@ public class BasicFunctionTest {
calc.click(0.5, 0.5);
sleep(1);
// Verify if the picture is inserted successfully
- rectangle = GraphicsUtil.findRectangle(calc.getScreenRectangle(),
- 0xFFFF0000);
+ rectangle = GraphicsUtil.findRectangle(calc.getScreenRectangle(), 0xFFFF0000);
assertNotNull("Red rectangle: " + rectangle, rectangle);
}
@@ -296,8 +233,7 @@ public class BasicFunctionTest {
sleep(1);
// Verify if the picture is inserted successfully
- Rectangle rectangle = GraphicsUtil.findRectangle(
- impress.getScreenRectangle(), 0xFF00FF00);
+ Rectangle rectangle = GraphicsUtil.findRectangle(impress.getScreenRectangle(), 0xFF00FF00);
assertNotNull("Green rectangle: " + rectangle, rectangle);
// assertEquals(new Rectangle(0,0,64,64), rectangle);
@@ -309,8 +245,7 @@ public class BasicFunctionTest {
impress.click(1, 1);
sleep(1);
// Verify if the picture is inserted successfully
- rectangle = GraphicsUtil.findRectangle(impress.getScreenRectangle(),
- 0xFFFF0000);
+ rectangle = GraphicsUtil.findRectangle(impress.getScreenRectangle(), 0xFFFF0000);
assertNotNull("Red rectangle: " + rectangle, rectangle);
}
@@ -322,23 +257,19 @@ public class BasicFunctionTest {
impress.waitForExistence(10, 2);
app.dispatch(".uno:Presentation");
sleep(3);
- Rectangle rectangle = GraphicsUtil.findRectangle(
- SlideShow.getScreenRectangle(), 0xFFFF0000);
+ Rectangle rectangle = GraphicsUtil.findRectangle(SlideShow.getScreenRectangle(), 0xFFFF0000);
assertNotNull("1st slide appears", rectangle);
SlideShow.click(0.5, 0.5);
sleep(2);
- rectangle = GraphicsUtil.findRectangle(SlideShow.getScreenRectangle(),
- 0xFF00FF00);
+ rectangle = GraphicsUtil.findRectangle(SlideShow.getScreenRectangle(), 0xFF00FF00);
assertNotNull("2nd slide appears", rectangle);
typeKeys("<enter>");
sleep(2);
- rectangle = GraphicsUtil.findRectangle(SlideShow.getScreenRectangle(),
- 0xFF0000FF);
+ rectangle = GraphicsUtil.findRectangle(SlideShow.getScreenRectangle(), 0xFF0000FF);
assertNotNull("3rd slide appears", rectangle);
SlideShow.click(0.5, 0.5);
sleep(2);
- rectangle = GraphicsUtil.findRectangle(SlideShow.getScreenRectangle(),
- 0xFF0000FF);
+ rectangle = GraphicsUtil.findRectangle(SlideShow.getScreenRectangle(), 0xFF0000FF);
assertNull("The end", rectangle);
SlideShow.click(0.5, 0.5);
sleep(3);
@@ -378,20 +309,15 @@ public class BasicFunctionTest {
@Test
public void testFillInSpreadsheet() {
- String[][] expected1 = new String[][] { { "1" }, { "1" }, { "1" },
- { "1" }, { "1" }, { "1" }, };
- String[][] expected2 = new String[][] { { "2" }, { "2" }, { "2" },
- { "2" }, { "2" }, { "2" }, };
+ String[][] expected1 = new String[][] { { "1" }, { "1" }, { "1" }, { "1" }, { "1" }, { "1" }, };
+ String[][] expected2 = new String[][] { { "2" }, { "2" }, { "2" }, { "2" }, { "2" }, { "2" }, };
- String[][] expected3 = new String[][] { { "Hi friends", "Hi friends",
- "Hi friends", "Hi friends" } };
+ String[][] expected3 = new String[][] { { "Hi friends", "Hi friends", "Hi friends", "Hi friends" } };
- String[][] expected4 = new String[][] { { "99999.999", "99999.999",
- "99999.999", "99999.999" } };
+ String[][] expected4 = new String[][] { { "99999.999", "99999.999", "99999.999", "99999.999" } };
String[][] expected5 = new String[][] {
- { "99999.999", "-10" }, { "100000.999", "-9" }, { "100001.999", "-8" },
- { "100002.999", "-7" }, { "100003.999", "-6" }
+ { "99999.999", "-10" }, { "100000.999", "-9" }, { "100001.999", "-8" }, { "100002.999", "-7" }, { "100003.999", "-6" }
};
// Create a new text document
@@ -402,29 +328,25 @@ public class BasicFunctionTest {
typeKeys("1<enter>");
CalcUtil.selectRange("C5:C10");
app.dispatch(".uno:FillDown");
- assertArrayEquals("Fill Down:", expected1,
- CalcUtil.getCellTexts("C5:C10"));
+ assertArrayEquals("Fill Down:", expected1, CalcUtil.getCellTexts("C5:C10"));
CalcUtil.selectRange("D10");
typeKeys("2<enter>");
CalcUtil.selectRange("D5:D10");
app.dispatch(".uno:FillUp");
- assertArrayEquals("Fill Up:", expected2,
- CalcUtil.getCellTexts("D5:D10"));
+ assertArrayEquals("Fill Up:", expected2, CalcUtil.getCellTexts("D5:D10"));
CalcUtil.selectRange("A1");
typeKeys("Hi friends<enter>");
CalcUtil.selectRange("A1:D1");
app.dispatch(".uno:FillRight");
- assertArrayEquals("Fill Right:", expected3,
- CalcUtil.getCellTexts("A1:D1"));
+ assertArrayEquals("Fill Right:", expected3, CalcUtil.getCellTexts("A1:D1"));
CalcUtil.selectRange("D2");
typeKeys("99999.999<enter>");
CalcUtil.selectRange("A2:D2");
app.dispatch(".uno:FillLeft");
- assertArrayEquals("Fill left:", expected4,
- CalcUtil.getCellTexts("A2:D2"));
+ assertArrayEquals("Fill left:", expected4, CalcUtil.getCellTexts("A2:D2"));
CalcUtil.selectRange("E1");
typeKeys("99999.999<tab>-10<enter>");
@@ -433,34 +355,25 @@ public class BasicFunctionTest {
app.dispatch(".uno:FillSeries");
FillSeriesDlg.ok();
sleep(1);
- assertArrayEquals("Fill series..", expected5,
- CalcUtil.getCellTexts("E1:F5"));
+ assertArrayEquals("Fill series..", expected5, CalcUtil.getCellTexts("E1:F5"));
}
@Test
public void testSort() {
- String[][] expected1 = new String[][] { { "-9999999" }, { "-1.1" },
- { "-1.1" }, { "0" }, { "0" }, { "0.1" }, { "10" }, { "12" },
- { "9999999" }, { "9999999" },
+ String[][] expected1 = new String[][] { { "-9999999" }, { "-1.1" }, { "-1.1" }, { "0" }, { "0" }, { "0.1" }, { "10" }, { "12" }, { "9999999" }, { "9999999" },
};
- String[][] expected2 = new String[][] { { "TRUE", "Oracle" },
- { "TRUE", "OpenOffice" }, { "FALSE", "OpenOffice" },
- { "TRUE", "IBM" }, { "FALSE", "IBM" }, { "TRUE", "Google" },
- { "FALSE", "facebook " }, { "TRUE", "Apache" },
- { "TRUE", "!yahoo" }, { "TRUE", "" },
+ String[][] expected2 = new String[][] { { "TRUE", "Oracle" }, { "TRUE", "OpenOffice" }, { "FALSE", "OpenOffice" }, { "TRUE", "IBM" }, { "FALSE", "IBM" },
+ { "TRUE", "Google" }, { "FALSE", "facebook " }, { "TRUE", "Apache" }, { "TRUE", "!yahoo" }, { "TRUE", "" },
};
- String[][] expected3 = new String[][] { { "Sunday" }, { "Monday" },
- { "Tuesday" }, { "Wednesday" }, { "Thursday" }, { "Friday" },
- { "Saturday" },
+ String[][] expected3 = new String[][] { { "Sunday" }, { "Monday" }, { "Tuesday" }, { "Wednesday" }, { "Thursday" }, { "Friday" }, { "Saturday" },
};
- String[][] expected4 = new String[][] { { "-$10.00" }, { "$0.00" },
- { "$0.00" }, { "$1.00" }, { "$3.00" }, { "$9.00" },
- { "$123.00" }, { "$200.00" }, { "$400.00" }, { "$10,000.00" },
+ String[][] expected4 = new String[][] { { "-$10.00" }, { "$0.00" }, { "$0.00" }, { "$1.00" }, { "$3.00" }, { "$9.00" }, { "$123.00" }, { "$200.00" }, { "$400.00" },
+ { "$10,000.00" },
};
String file = prepareData("sort.ods");
@@ -473,8 +386,7 @@ public class BasicFunctionTest {
assertEquals(1, SortPage_By1.getSelIndex());
SortPage.ok();
sleep(1);
- assertArrayEquals("Sorted Data", expected1,
- CalcUtil.getCellTexts("A1:A10"));
+ assertArrayEquals("Sorted Data", expected1, CalcUtil.getCellTexts("A1:A10"));
CalcUtil.selectRange("B1:C10");
app.dispatch(".uno:DataSort");
@@ -496,28 +408,24 @@ public class BasicFunctionTest {
SortPage.ok();
sleep(1);
- assertArrayEquals("Sorted Data", expected2,
- CalcUtil.getCellTexts("B1:C10"));
+ assertArrayEquals("Sorted Data", expected2, CalcUtil.getCellTexts("B1:C10"));
CalcUtil.selectRange("D1:D7");
app.dispatch(".uno:DataSort");
SortWarningDlg_Current.click();
SortOptionsPage.select();
SortOptionsPage_RangeContainsColumnLabels.uncheck();
SortOptionsPage_CustomSortOrder.check();
- SortOptionsPage_CustomSortOrderList
- .select("Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday");
+ SortOptionsPage_CustomSortOrderList.select("Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday");
SortOptionsPage.ok();
sleep(1);
- assertArrayEquals("Sorted Data", expected3,
- CalcUtil.getCellTexts("D1:D7"));
+ assertArrayEquals("Sorted Data", expected3, CalcUtil.getCellTexts("D1:D7"));
CalcUtil.selectRange("E1:E10");
app.dispatch(".uno:DataSort");
SortWarningDlg_Current.click();
SortPage.ok();
sleep(1);
- assertArrayEquals("Sorted Data", expected4,
- CalcUtil.getCellTexts("E1:E10"));
+ assertArrayEquals("Sorted Data", expected4, CalcUtil.getCellTexts("E1:E10"));
}
/**
@@ -637,7 +545,8 @@ public class BasicFunctionTest {
sleep(3);
// Verify if the table toolbar is active
- typeKeys("123"); // Insert text to focus on table, to avoid Bug 120171 on linux
+ typeKeys("123"); // Insert text to focus on table, to avoid Bug 120171
+ // on linux
assertTrue(Table_Toolbar.exists(3));
// Focus on edit pane
@@ -695,7 +604,8 @@ public class BasicFunctionTest {
sleep(3);
// Verify if the table toolbar is active
- typeKeys("123"); // Insert text to focus on table, to avoid Bug 120171 on linux
+ typeKeys("123"); // Insert text to focus on table, to avoid Bug 120171
+ // on linux
assertTrue(Table_Toolbar.exists(3));
// // Check the statusbar to verify if the table is inserted
@@ -719,7 +629,7 @@ public class BasicFunctionTest {
// Create a new spreadsheet document
app.dispatch("private:factory/scalc");
calc.waitForExistence(10, 2);
-
+
// Insert source numbers
String sourceNumber1 = "5";
String sourceNumber2 = "3";
@@ -735,8 +645,7 @@ public class BasicFunctionTest {
typeKeys("<enter>");
// Verify if the calculated result is equal to the expected result
- assertEquals("The calculated result", expectedResult,
- CalcUtil.getCellText("C1"));
+ assertEquals("The calculated result", expectedResult, CalcUtil.getCellText("C1"));
}
/**
@@ -765,8 +674,7 @@ public class BasicFunctionTest {
typeKeys("<enter>");
// Verify if the calculated result is equal to the expected result
- assertEquals("The calculated result", expectedResult,
- CalcUtil.getCellText("D1"));
+ assertEquals("The calculated result", expectedResult, CalcUtil.getCellText("D1"));
}
/**
@@ -793,15 +701,14 @@ public class BasicFunctionTest {
// Insert a function via Function Wizard Dialog: ABS
CalcUtil.selectRange("B1");
app.dispatch(".uno:FunctionDialog");
-// SC_FunctionWizardDlg_FunctionList.doubleClick(5, 5);
- SC_FunctionWizardDlg_FunctionList.select("ABS");
- SC_FunctionWizardDlg_Next.click(); // Use "Next" button
+ // SC_FunctionWizardDlg_FunctionList.doubleClick(5, 5);
+ SC_FunctionWizardDlg_FunctionList.select("ABS");
+ SC_FunctionWizardDlg_Next.click(); // Use "Next" button
SC_FunctionWizardDlg_Edit1.inputKeys("A1");
SC_FunctionWizardDlg.ok();
// Verify if the calculated result is equal to the expected result
- assertEquals("The calculated result", expectedResult,
- CalcUtil.getCellText("B1"));
+ assertEquals("The calculated result", expectedResult, CalcUtil.getCellText("B1"));
}
}
Modified: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/bvt/FileTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/bvt/FileTypeTest.java?rev=1378870&r1=1378869&r2=1378870&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/bvt/FileTypeTest.java (original)
+++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/bvt/FileTypeTest.java Thu Aug 30 09:27:21 2012
@@ -24,28 +24,11 @@
*/
package testcase.gui.bvt;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.openoffice.test.common.Testspace.getPath;
-import static org.openoffice.test.common.Testspace.prepareData;
-import static org.openoffice.test.vcl.Tester.sleep;
-import static org.openoffice.test.vcl.Tester.typeText;
-import static testlib.gui.AppUtil.openStartcenter;
-import static testlib.gui.AppUtil.submitOpenDlg;
-import static testlib.gui.AppUtil.submitSaveDlg;
-import static testlib.gui.AppUtil.typeKeys;
-import static testlib.gui.UIMap.AlienFormatDlg;
-import static testlib.gui.UIMap.EffectsPage;
-import static testlib.gui.UIMap.EffectsPage_Color;
-import static testlib.gui.UIMap.PresentationWizard;
-import static testlib.gui.UIMap.app;
-import static testlib.gui.UIMap.calc;
-import static testlib.gui.UIMap.draw;
-import static testlib.gui.UIMap.impress;
-import static testlib.gui.UIMap.math_EditWindow;
-import static testlib.gui.UIMap.math_ElementsWindow;
-import static testlib.gui.UIMap.writer;
+import static org.junit.Assert.*;
+import static org.openoffice.test.common.Testspace.*;
+import static org.openoffice.test.vcl.Tester.*;
+import static testlib.gui.AppUtil.*;
+import static testlib.gui.UIMap.*;
import java.awt.Rectangle;
@@ -56,9 +39,9 @@ import org.junit.Rule;
import org.junit.Test;
import org.openoffice.test.common.FileUtil;
import org.openoffice.test.common.GraphicsUtil;
+import org.openoffice.test.common.Logger;
import testlib.gui.CalcUtil;
-import testlib.gui.Log;
/**
*
@@ -66,7 +49,7 @@ import testlib.gui.Log;
public class FileTypeTest {
@Rule
- public Log LOG = new Log();
+ public Logger log = Logger.getLogger(this);
@Before
public void setUp() throws Exception {
@@ -131,8 +114,7 @@ public class FileTypeTest {
sleep(1);
// Verify the text via system clip board
- Assert.assertEquals("The typed text into writer", text,
- app.getClipboard());
+ Assert.assertEquals("The typed text into writer", text, app.getClipboard());
// Set the text style
writer.openContextMenu();
@@ -163,8 +145,7 @@ public class FileTypeTest {
typeKeys("<$copy>");
sleep(1);
// Verify if the text still exists in the file
- Assert.assertEquals("The typed text into writer is saved!", text,
- app.getClipboard());
+ Assert.assertEquals("The typed text into writer is saved!", text, app.getClipboard());
}
@Test
@@ -216,8 +197,7 @@ public class FileTypeTest {
app.dispatch(".uno:Open");
submitOpenDlg(saveTo);
calc.waitForExistence(10, 2);
- Assert.assertEquals("The typed text is saved!", text,
- CalcUtil.getCellText("A65536"));
+ Assert.assertEquals("The typed text is saved!", text, CalcUtil.getCellText("A65536"));
}
@Test
@@ -256,11 +236,10 @@ public class FileTypeTest {
app.dispatch("private:factory/simpress?slot=6686");
PresentationWizard.ok();
impress.waitForExistence(10, 2);
+ sleep(2);
impress.click(0.01, 0.01);
typeKeys(text);
- sleep(2);
impress.doubleClick(0.1, 0.5);
-
app.dispatch(".uno:SaveAs");
FileUtil.deleteFile(saveTo);
submitSaveDlg(saveTo);
@@ -279,8 +258,7 @@ public class FileTypeTest {
// app.setClipboard(".wrong");
typeKeys("<$copy>");
sleep(1);
- Assert.assertEquals("The typed text is saved!", text, app
- .getClipboard().trim());
+ Assert.assertEquals("The typed text is saved!", text, app.getClipboard().trim());
}
// drawing
@@ -343,8 +321,7 @@ public class FileTypeTest {
sleep(1);
// Verify if the picture is inserted successfully
- Rectangle rectangle = GraphicsUtil.findRectangle(
- draw.getScreenRectangle(), 0xFF00FF00);
+ Rectangle rectangle = GraphicsUtil.findRectangle(draw.getScreenRectangle(), 0xFF00FF00);
assertNotNull("Green rectangle: " + rectangle, rectangle);
// Save the drawing
@@ -366,8 +343,7 @@ public class FileTypeTest {
draw.waitForExistence(10, 2);
// Verify if the picture still exists in the file
- Rectangle rectangle1 = GraphicsUtil.findRectangle(
- draw.getScreenRectangle(), 0xFF00FF00);
+ Rectangle rectangle1 = GraphicsUtil.findRectangle(draw.getScreenRectangle(), 0xFF00FF00);
assertNotNull("Green rectangle: " + rectangle1, rectangle1);
}
@@ -406,14 +382,10 @@ public class FileTypeTest {
*/
public void saveNewMath(String filename) {
String saveTo = getPath("temp/" + filename);
-
// Create a new math
app.dispatch("private:factory/smath");
math_EditWindow.waitForExistence(10, 2);
-
- // Verify if the Elements window is active
- assertTrue(math_ElementsWindow.exists(3));
-
+ sleep(2);
// Insert a formula
String text = "5 times 3 = 15";
typeText(text);
@@ -446,8 +418,7 @@ public class FileTypeTest {
app.dispatch(".uno:Select");
typeKeys("<$copy>");
sleep(1);
- assertEquals("The typed formula into math is saved", text,
- app.getClipboard());
+ assertEquals("The typed formula into math is saved", text, app.getClipboard());
// Close the file to avoid the app closing the Elements window
// automatically
Modified: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/bvt/SmokeTest.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/bvt/SmokeTest.java?rev=1378870&r1=1378869&r2=1378870&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/bvt/SmokeTest.java (original)
+++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/bvt/SmokeTest.java Thu Aug 30 09:27:21 2012
@@ -19,17 +19,13 @@
*
*************************************************************/
-
-
package testcase.gui.bvt;
-import static org.junit.Assert.assertTrue;
-import static org.openoffice.test.common.FileUtil.readFileAsString;
-import static org.openoffice.test.common.Testspace.prepareData;
-import static testlib.gui.AppUtil.submitOpenDlg;
-import static testlib.gui.UIMap.app;
-import static testlib.gui.UIMap.oo;
-import static testlib.gui.UIMap.writer;
+import static org.junit.Assert.*;
+import static org.openoffice.test.common.FileUtil.*;
+import static org.openoffice.test.common.Testspace.*;
+import static testlib.gui.AppUtil.*;
+import static testlib.gui.UIMap.*;
import java.io.File;
@@ -37,21 +33,20 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-
-import testlib.gui.Log;
+import org.openoffice.test.common.Logger;
public class SmokeTest {
@Rule
- public Log LOG = new Log();
+ public Logger log = Logger.getLogger(this);
File smoketestOutput;
-
+
@Before
public void setUp() throws Exception {
-// app.getOpenOffice().cleanUserInstallation();
-// app.start();
- app.start(true); // Default to clean user installation
+ // app.getOpenOffice().cleanUserInstallation();
+ // app.start();
+ app.start(true); // Default to clean user installation
smoketestOutput = new File(oo.getUserInstallation(), "user/temp");
}
@@ -59,7 +54,7 @@ public class SmokeTest {
public static void afterClass() throws Exception {
app.close();
}
-
+
@Test
public void testMacro() {
prepareData("TestExtension.oxt");
@@ -72,7 +67,7 @@ public class SmokeTest {
app.dispatch("vnd.sun.star.script:Standard.Global.StartTestWithDefaultOptions?language=Basic&location=document", 120);
String smoketestlog = readFileAsString(new File(smoketestOutput, "smoketest.log"));
String testclosurelog = readFileAsString(new File(smoketestOutput, "testclosure.log"));
- LOG.info(smoketestlog + "\n" + testclosurelog);
+ log.info(smoketestlog + "\n" + testclosurelog);
assertTrue("No Error", !smoketestlog.contains("error") && !testclosurelog.contains("error"));
}
Modified: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/formula/catalog/AddDeleteSymbolsFromCatalog.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/formula/catalog/AddDeleteSymbolsFromCatalog.java?rev=1378870&r1=1378869&r2=1378870&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/formula/catalog/AddDeleteSymbolsFromCatalog.java (original)
+++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/formula/catalog/AddDeleteSymbolsFromCatalog.java Thu Aug 30 09:27:21 2012
@@ -19,22 +19,19 @@
*
*************************************************************/
-
-
/**
*
*/
package testcase.gui.formula.catalog;
-import static testlib.gui.AppUtil.*;
-import static testlib.gui.UIMap.*;
import static org.junit.Assert.*;
+import static testlib.gui.UIMap.*;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-
-import testlib.gui.Log;
+import org.openoffice.test.common.Logger;
/**
*
@@ -42,19 +39,19 @@ import testlib.gui.Log;
public class AddDeleteSymbolsFromCatalog {
@Rule
- public Log LOG = new Log();
-
+ public Logger log = Logger.getLogger(this);
+
@Before
public void setUp() throws Exception {
app.start(true);
-
+
// New a formula document
app.dispatch("private:factory/smath");
math_EditWindow.waitForExistence(10, 2);
-
+
// Click catalog button
math_CatalogButton.click();
-
+
// Select "Special", click "Edit" button
math_SymbolsDlgListbox.select(2);
math_SymbolsDlgEditButton.click();
@@ -62,29 +59,37 @@ public class AddDeleteSymbolsFromCatalog
@After
public void tearDown() throws Exception {
-
+
}
/**
* Test add custom symbols from Catalog->Symbols
+ *
* @throws Exception
*/
@Test
- public void testAddSymbolFromCatalog() throws Exception{
-
+ public void testAddSymbolFromCatalog() throws Exception {
+
// Choose a symbol which is not in the list, click "Add" and "OK"
String selectedSymbol;
boolean bSelectSymbolNotInList;
int nListCount;
int nIndex = 1;
do {
- math_EditSymbolsDlgViewControl.click(100*nIndex, 10); // risk: after 6 or 7 circles, this will click out of ViewControl
+ math_EditSymbolsDlgViewControl.click(100 * nIndex, 10); // risk:
+ // after 6
+ // or 7
+ // circles,
+ // this will
+ // click out
+ // of
+ // ViewControl
selectedSymbol = math_EditSymbolsDlgSymbol.getText();
nIndex++;
// Find if the selected symbol is already in the list
bSelectSymbolNotInList = false;
nListCount = math_EditSymbolsDlgSymbol.getItemCount();
- for (int i=0; i<nListCount; i++) {
+ for (int i = 0; i < nListCount; i++) {
if (selectedSymbol.equals(math_EditSymbolsDlgSymbol.getItemText(i))) {
bSelectSymbolNotInList = true;
break;
@@ -93,104 +98,116 @@ public class AddDeleteSymbolsFromCatalog
} while (bSelectSymbolNotInList);
math_EditSymbolsDlgAdd.click();
math_EditSymbolsDlg.ok();
-
+
// Verify if the symbol is added to Symbol set
math_SymbolsDlgEditButton.click();
bSelectSymbolNotInList = false;
nListCount = math_EditSymbolsDlgSymbol.getItemCount();
- for (int i=0; i<nListCount; i++) {
+ for (int i = 0; i < nListCount; i++) {
if (selectedSymbol.equals(math_EditSymbolsDlgSymbol.getItemText(i))) {
bSelectSymbolNotInList = true;
break;
}
}
assertTrue("Symbol is not added to Symbol set", bSelectSymbolNotInList);
-
+
// Close all dialogs
math_EditSymbolsDlg.cancel();
math_SymbolsDlg.close();
app.dispatch(".uno:CloseDoc");
}
-
+
/**
* Test modify font of custom symbols from Catalog->Symbols
+ *
* @throws Exception
*/
@Test
- public void testModifySymbolFontFromCatalog() throws Exception{
-
+ public void testModifySymbolFontFromCatalog() throws Exception {
+
// Modify the font of selected symbol
- //String selectedSymbol = math_EditSymbolsDlgSymbol.getText();
+ // String selectedSymbol = math_EditSymbolsDlgSymbol.getText();
int oldSymbolFontIndex = math_EditSymbolsDlgFont.getSelIndex();
- int modifiedSymbolFondIndex = (oldSymbolFontIndex+1==math_EditSymbolsDlgFont.getItemCount()) ? 0 : (oldSymbolFontIndex+1);
- math_EditSymbolsDlgFont.select(modifiedSymbolFondIndex); // select the next font of old font
+ int modifiedSymbolFondIndex = (oldSymbolFontIndex + 1 == math_EditSymbolsDlgFont.getItemCount()) ? 0 : (oldSymbolFontIndex + 1);
+ math_EditSymbolsDlgFont.select(modifiedSymbolFondIndex); // select the
+ // next font
+ // of old
+ // font
String modifiedSymbolFont = math_EditSymbolsDlgFont.getSelText();
String selectedSymbol = math_EditSymbolsDlgSymbol.getText();
math_EditSymbolsDlgModify.click();
math_EditSymbolsDlg.ok();
-
+
// Verify if the font of symbol is modified successfully
math_SymbolsDlgEditButton.click();
math_EditSymbolsDlgSymbol.select(selectedSymbol);
assertEquals("Font of symbol is not modified successfully", modifiedSymbolFont, math_EditSymbolsDlgFont.getSelText());
-
+
// Close all dialogs
math_EditSymbolsDlg.cancel();
math_SymbolsDlg.close();
app.dispatch(".uno:CloseDoc");
}
-
+
/**
* Test modify typeface of custom symbols from Catalog->Symbols
+ *
* @throws Exception
*/
@Test
- public void testModifySymbolTypefaceFromCatalog() throws Exception{
-
+ public void testModifySymbolTypefaceFromCatalog() throws Exception {
+
// Modify the typeface of selected symbol
-// String selectedSymbol = math_EditSymbolsDlgSymbol.getText();
+ // String selectedSymbol = math_EditSymbolsDlgSymbol.getText();
int oldSymbolTypefaceIndex = math_EditSymbolsDlgTypeface.getSelIndex();
- int modifiedSymbolTypefaceIndex = (oldSymbolTypefaceIndex+1==math_EditSymbolsDlgTypeface.getItemCount()) ? 0 : (oldSymbolTypefaceIndex+1);
- math_EditSymbolsDlgTypeface.select(modifiedSymbolTypefaceIndex); // select the next typeface of old typeface
- String modifiedSymbolTypeface= math_EditSymbolsDlgTypeface.getSelText();
+ int modifiedSymbolTypefaceIndex = (oldSymbolTypefaceIndex + 1 == math_EditSymbolsDlgTypeface.getItemCount()) ? 0 : (oldSymbolTypefaceIndex + 1);
+ math_EditSymbolsDlgTypeface.select(modifiedSymbolTypefaceIndex); // select
+ // the
+ // next
+ // typeface
+ // of
+ // old
+ // typeface
+ String modifiedSymbolTypeface = math_EditSymbolsDlgTypeface.getSelText();
String selectedSymbol = math_EditSymbolsDlgSymbol.getText();
math_EditSymbolsDlgModify.click();
math_EditSymbolsDlg.ok();
-
+
// Verify if the typeface of symbol is modified successfully
math_SymbolsDlgEditButton.click();
math_EditSymbolsDlgSymbol.select(selectedSymbol);
assertEquals("Typeface of symbol is not modified successfully", modifiedSymbolTypeface, math_EditSymbolsDlgTypeface.getSelText());
-
+
// Close all dialogs
math_EditSymbolsDlg.cancel();
math_SymbolsDlg.close();
app.dispatch(".uno:CloseDoc");
}
-
+
/**
* Test delete custom symbols from Catalog->Symbols
+ *
* @throws Exception
*/
@Test
- public void testDeleteSymbolFromCatalog() throws Exception{
-
+ public void testDeleteSymbolFromCatalog() throws Exception {
+
// Delete the selected symbol
String selectedSymbol = math_EditSymbolsDlgSymbol.getText();
math_EditSymbolsDlgDelete.click();
math_EditSymbolsDlg.ok();
-
+
// Verify if the selected symbol is deleted successfully
math_SymbolsDlgEditButton.click();
boolean isDeleted = true;
- for (int i=0; i<math_EditSymbolsDlgSymbol.getItemCount(); i++) {
- if (selectedSymbol.equals(math_EditSymbolsDlgSymbol.getItemText(i))){
+ for (int i = 0; i < math_EditSymbolsDlgSymbol.getItemCount(); i++) {
+ if (selectedSymbol.equals(math_EditSymbolsDlgSymbol.getItemText(i))) {
isDeleted = false;
break;
}
}
assertTrue("Symbol is not deleted successfully", isDeleted);
-
+
// Close all dialogs
math_EditSymbolsDlg.cancel();
math_SymbolsDlg.close();
Modified: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/formula/catalog/InputCharacterFromCatalogDlg.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/formula/catalog/InputCharacterFromCatalogDlg.java?rev=1378870&r1=1378869&r2=1378870&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/formula/catalog/InputCharacterFromCatalogDlg.java (original)
+++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/formula/catalog/InputCharacterFromCatalogDlg.java Thu Aug 30 09:27:21 2012
@@ -19,22 +19,19 @@
*
*************************************************************/
-
-
/**
*
*/
package testcase.gui.formula.catalog;
-import static testlib.gui.AppUtil.*;
-import static testlib.gui.UIMap.*;
import static org.junit.Assert.*;
+import static testlib.gui.UIMap.*;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-
-import testlib.gui.Log;
+import org.openoffice.test.common.Logger;
/**
*
@@ -42,102 +39,132 @@ import testlib.gui.Log;
public class InputCharacterFromCatalogDlg {
@Rule
- public Log LOG = new Log();
-
+ public Logger log = Logger.getLogger(this);
+
@Before
public void setUp() throws Exception {
app.start(true);
-
+
// New a formula document
- app.dispatch("private:factory/smath");
+ app.dispatch("private:factory/smath");
math_EditWindow.waitForExistence(10, 2);
-
+
// Click catalog button
math_CatalogButton.click();
}
@After
public void tearDown() throws Exception {
-
+
}
-
+
/**
* Test input Greek character from Catalog->Symbols
+ *
* @throws Exception
*/
@Test
- public void testInputGreekFromCatalog() throws Exception{
-
+ public void testInputGreekFromCatalog() throws Exception {
+
// Select "Greek", click "Edit" button to get the selected Symbol
math_SymbolsDlgListbox.select(0);
math_SymbolsDlgEditButton.click();
String selectedSymbol = math_EditSymbolsDlgSymbol.getText();
math_EditSymbolsDlg.ok();
-
+
// Insert the selected symbol
math_SymbolsDlgInsertButton.click();
math_SymbolsDlgCloseButton.click();
-
+
// Verify if the symbol is inserted successfully
math_EditWindow.click(5, 5);
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("Symbol is not inserted succcessfully", "%".concat(selectedSymbol).concat(" "), app.getClipboard()); // add "%" in the front, add " " in the end
-
+ assertEquals("Symbol is not inserted succcessfully", "%".concat(selectedSymbol).concat(" "), app.getClipboard()); // add
+ // "%"
+ // in
+ // the
+ // front,
+ // add
+ // " "
+ // in
+ // the
+ // end
+
// Close all dialogs
app.dispatch(".uno:CloseDoc");
}
-
+
/**
* Test input iGreek character from Catalog->Symbols
+ *
* @throws Exception
*/
@Test
- public void testInputIGreekFromCatalog() throws Exception{
-
+ public void testInputIGreekFromCatalog() throws Exception {
+
// Select "iGreek", click "Edit" button to get the selected Symbol
math_SymbolsDlgListbox.select(1);
math_SymbolsDlgEditButton.click();
String selectedSymbol = math_EditSymbolsDlgSymbol.getText();
math_EditSymbolsDlg.ok();
-
+
// Insert the selected symbol
math_SymbolsDlgInsertButton.click();
math_SymbolsDlgCloseButton.click();
-
+
// Verify if the symbol is inserted successfully
math_EditWindow.click(5, 5);
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("Symbol is not inserted succcessfully", "%".concat(selectedSymbol).concat(" "), app.getClipboard()); // add "%" in the front, add " " in the end
-
+ assertEquals("Symbol is not inserted succcessfully", "%".concat(selectedSymbol).concat(" "), app.getClipboard()); // add
+ // "%"
+ // in
+ // the
+ // front,
+ // add
+ // " "
+ // in
+ // the
+ // end
+
// Close all dialogs
app.dispatch(".uno:CloseDoc");
}
-
+
/**
* Test input Special character from Catalog->Symbols
+ *
* @throws Exception
*/
@Test
- public void testInputSpecialFromCatalog() throws Exception{
-
+ public void testInputSpecialFromCatalog() throws Exception {
+
// Select "Special", "Insert" the default first symbol
math_SymbolsDlgListbox.select(2);
- math_SymbolsDlgInsertButton.click();
-
+ math_SymbolsDlgInsertButton.click();
+
// Click "Edit" button to get the selected Symbol
math_SymbolsDlgEditButton.click();
String selectedSymbol = math_EditSymbolsDlgSymbol.getText();
math_EditSymbolsDlg.ok();
math_SymbolsDlgCloseButton.click();
-
+
// Verify if the symbol is inserted successfully
math_EditWindow.click(5, 5);
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("Symbol is not inserted succcessfully", "%".concat(selectedSymbol).concat(" "), app.getClipboard()); // add "%" in the front, add " " in the end
-
+ assertEquals("Symbol is not inserted succcessfully", "%".concat(selectedSymbol).concat(" "), app.getClipboard()); // add
+ // "%"
+ // in
+ // the
+ // front,
+ // add
+ // " "
+ // in
+ // the
+ // end
+
// Close all dialogs
app.dispatch(".uno:CloseDoc");
}
Modified: incubator/ooo/trunk/main/test/testgui/source/testcase/gui/formula/importexport/CreateFormulaInDifferentWays.java
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/test/testgui/source/testcase/gui/formula/importexport/CreateFormulaInDifferentWays.java?rev=1378870&r1=1378869&r2=1378870&view=diff
==============================================================================
--- incubator/ooo/trunk/main/test/testgui/source/testcase/gui/formula/importexport/CreateFormulaInDifferentWays.java (original)
+++ incubator/ooo/trunk/main/test/testgui/source/testcase/gui/formula/importexport/CreateFormulaInDifferentWays.java Thu Aug 30 09:27:21 2012
@@ -19,24 +19,24 @@
*
*************************************************************/
-
-
/**
*
*/
package testcase.gui.formula.importexport;
-import static testlib.gui.AppUtil.*;
-import static testlib.gui.UIMap.*;
import static org.junit.Assert.*;
import static org.openoffice.test.common.Testspace.*;
+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.junit.Ignore;
import org.openoffice.test.common.FileUtil;
-import testlib.gui.Log;
+import org.openoffice.test.common.Logger;
/**
*
@@ -44,93 +44,100 @@ import testlib.gui.Log;
public class CreateFormulaInDifferentWays {
@Rule
- public Log LOG = new Log();
-
+ public Logger log = Logger.getLogger(this);
+
@Before
public void setUp() throws Exception {
app.start(true);
-
+
// New a formula document
app.dispatch("private:factory/smath");
}
@After
public void tearDown() throws Exception {
-
+
}
-
+
/**
* Test elements window active and inactive
+ *
* @throws Exception
*/
@Test
- public void testElementsWindowActive() throws Exception{
+ public void testElementsWindowActive() throws Exception {
// Check if the "View->Elements" menu is selected
boolean viewElements = math_ElementsWindow.exists();
// Active or inactive the Elements window
app.dispatch(".uno:ToolBox");
-
+
assertNotSame("Elements window active/inactive failed", viewElements, math_ElementsWindow.exists());
}
-
+
/**
* Test create a formula from Elements window
+ *
* @throws Exception
*/
@Test
- public void testCreateFormulaFromElementsWindow() throws Exception{
+ public void testCreateFormulaFromElementsWindow() throws Exception {
String saveTo = getPath("temp/" + "FormulaFromElements.odf");
// Make Elements window pop up
if (!math_ElementsWindow.exists()) {
app.dispatch(".uno:ToolBox");
}
-
- // Click a formula in Elements window and edit the formula in the commands window
+
+ // Click a formula in Elements window and edit the formula in the
+ // commands window
math_ElementsRelations.click();
math_ElementsRelationsNotEqual.click();
typeKeys("a");
app.dispatch(".uno:NextMark");
typeKeys("b");
String insertedFormula = "a <> b";
-
+
// Verify if the formula is correct
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("The inserted formula into math", insertedFormula.concat(" "), app.getClipboard()); // add " "
-
+ assertEquals("The inserted formula into math", insertedFormula.concat(" "), app.getClipboard()); // add
+ // " "
+
// Save the formula
app.dispatch(".uno:SaveAs");
FileUtil.deleteFile(saveTo);
submitSaveDlg(saveTo);
-
+
// Close and reopen it
app.dispatch(".uno:CloseDoc");
openStartcenter();
app.dispatch(".uno:Open");
submitOpenDlg(saveTo);
- math_EditWindow.waitForExistence(10, 2);
-
+ math_EditWindow.waitForExistence(10, 2);
+
// Verify if the formula still exists in the file, and correct
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("The inserted formula into math", insertedFormula.concat(" "), app.getClipboard()); // add " "
-
+ assertEquals("The inserted formula into math", insertedFormula.concat(" "), app.getClipboard()); // add
+ // " "
+
// Close all dialogs
app.dispatch(".uno:CloseDoc");
}
-
+
/**
* Test create a formula from right click menu in equation editor
+ *
* @throws Exception
*/
@Test
- public void testCreateFormulaFromRightClickMenu() throws Exception{
+ public void testCreateFormulaFromRightClickMenu() throws Exception {
String saveTo = getPath("temp/" + "FormulaFromRightClickMenu.odf");
-
- // Right click in equation editor, choose "Functions->More->arcsin(x)", input a
+
+ // Right click in equation editor, choose "Functions->More->arcsin(x)",
+ // input a
math_EditWindow.rightClick(5, 5);
typeKeys("<down>");
typeKeys("<down>");
@@ -141,63 +148,69 @@ public class CreateFormulaInDifferentWay
typeKeys("<enter>");
typeKeys("<enter>");
typeKeys("a");
- sleep(2); // If no sleep, error occur on mac
+ sleep(2); // If no sleep, error occur on mac
String insertedFormula = "arcsin(a)";
-
+
// Verify if the formula is correct
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("The inserted formula into math", insertedFormula.concat(" "), app.getClipboard()); // add " "
-
+ assertEquals("The inserted formula into math", insertedFormula.concat(" "), app.getClipboard()); // add
+ // " "
+
// Save the formula
app.dispatch(".uno:SaveAs");
FileUtil.deleteFile(saveTo);
submitSaveDlg(saveTo);
-
+
// Close and reopen it
app.dispatch(".uno:CloseDoc");
openStartcenter();
app.dispatch(".uno:Open");
submitOpenDlg(saveTo);
- math_EditWindow.waitForExistence(10, 2);
-
+ math_EditWindow.waitForExistence(10, 2);
+
// Verify if the formula still exists in the file, and correct
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("The inserted formula into math", insertedFormula.concat(" "), app.getClipboard()); // add " "
-
+ assertEquals("The inserted formula into math", insertedFormula.concat(" "), app.getClipboard()); // add
+ // " "
+
// Close all dialogs
app.dispatch(".uno:CloseDoc");
}
-
+
/**
* Test undo/redo in math
+ *
* @throws Exception
*/
@Ignore("Bug 119077 - defect in windows only")
- public void testUndoRedoInMath() throws Exception{
+ public void testUndoRedoInMath() throws Exception {
// Make Elements window pop up
if (!math_ElementsWindow.exists()) {
app.dispatch(".uno:ToolBox");
}
-
- // Click a formula in Elements window and edit the formula in the commands window
+
+ // Click a formula in Elements window and edit the formula in the
+ // commands window
math_ElementsUnaryBinary.click();
math_ElementsUnaryBinaryPlus.click();
- typeKeys("a"); // "+a";
-
+ typeKeys("a"); // "+a";
+
// Undo and verify if it works fine
app.dispatch(".uno:Undo");
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("The inserted formula into math", "+<?> ", app.getClipboard()); // add " "
-
+ assertEquals("The inserted formula into math", "+<?> ", app.getClipboard()); // add
+ // " "
+
// Redo and verify if it works fine
app.dispatch(".uno:Redo");
app.dispatch(".uno:Select");
app.dispatch(".uno:Copy");
- assertEquals("The inserted formula into math", "+a ", app.getClipboard()); // add " "
+ assertEquals("The inserted formula into math", "+a ", app.getClipboard()); // add
+ // " "
}
}