Kaydet (Commit) 41e30e1d authored tarafından Liu Zhe's avatar Liu Zhe

#120234# - testcommon enhancement: uno api test support, multiple instances support.

Replaced AppUtil.initApp to VclApp.start.
üst 428f563b
......@@ -33,10 +33,9 @@ import static testlib.UIMap.*;
import java.awt.Rectangle;
import org.junit.AfterClass;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.openoffice.test.common.FileUtil;
......@@ -53,13 +52,14 @@ public class BVTFileType {
@Rule
public Log LOG = new Log();
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
initApp();
app.start();
}
@After
public void tearDown() throws Exception {
app.close();
}
/**
......@@ -241,6 +241,7 @@ public class BVTFileType {
String text = "Hello Openoffice";
app.dispatch("private:factory/simpress?slot=6686");
PresentationWizard.ok();
sleep(1);
impress.click(0.01, 0.01);
typeKeys(text);
sleep(2);
......@@ -436,9 +437,4 @@ public class BVTFileType {
// Close the file to avoid the app closing the Elements window automatically
app.dispatch(".uno:CloseDoc", 3);
}
@AfterClass
public static void afterClass() {
app.kill();
}
}
......@@ -34,14 +34,13 @@ import static testlib.UIMap.*;
import java.awt.Rectangle;
import java.io.File;
import org.junit.AfterClass;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
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.SystemUtil;
import testlib.CalcUtil;
import testlib.Log;
......@@ -55,12 +54,14 @@ public class BVTFunction {
@Rule
public Log LOG = new Log();
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
initApp();
app.start();
}
@After
public void tearDown() throws Exception {
app.close();
}
......@@ -77,14 +78,10 @@ public class BVTFunction {
FileUtil.deleteFile(exportTo);
submitSaveDlg(exportTo);
assertTrue("PDF is exported?", new File(exportTo).exists());
// Via toolbar
app.dispatch("private:factory/swriter", 3);
assertTrue(toolbox(".HelpId:standardbar").exists(5));
button(".uno:ExportDirectToPDF").click();
assertEquals("PDF - Portable Document Format (.pdf)", FileSave_FileType.getSelText());
FileSave.cancel();
}
/**
......@@ -112,7 +109,7 @@ public class BVTFunction {
//Create a new text document and launch a Wizards dialog which need JVM work correctly.
app.dispatch("private:factory/swriter", 3);
File tempfile=new File(app.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");
......@@ -768,9 +765,4 @@ public class BVTFunction {
// Verify if the calculated result is equal to the expected result
assertEquals("The calculated result", expectedResult, CalcUtil.getCellText("B1"));
}
@AfterClass
public static void afterClass() {
app.kill();
}
}
......@@ -28,6 +28,7 @@ import static testlib.UIMap.*;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
......@@ -50,7 +51,12 @@ public class LongRun {
*/
@Before
public void setUp() throws Exception {
initApp();
app.start();
}
@After
public void tearDown() throws Exception {
app.close();
}
Rectangle rect = new Rectangle(400, 200, 60, 60);
......@@ -129,7 +135,7 @@ public class LongRun {
saveNewDrawing("draw_saveas.std");
long end = System.currentTimeMillis();
LOG.info("Iterator: " + i + ", Elapsed Hours: " + ((end - start) / 3600000));
SystemUtil.execScript("ps -eo vsz,rss,comm | grep soffice.bin", false);
SystemUtil.execScript("ps -eo vsz,rss,comm | grep soffice.bin");
}
}
......
......@@ -27,6 +27,7 @@ import static org.junit.Assert.*;
import static testlib.AppUtil.*;
import static testlib.UIMap.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
......@@ -50,17 +51,25 @@ public class SayHelloToOO {
@Rule
public Log LOG = new Log();
/**
* initApp helps us to do
* 1. Patch the OpenOffice to enable automation if necessary.
* 2. Start OpenOffice with automation enabled if necessary.
* 3. Reset OpenOffice to startcenter.
*
* @throws java.lang.Exception
* Do some setup task before running test
* @throws Exception
*/
@Before
public void setUp() throws Exception {
initApp();
//Start OpenOffice
app.start();
}
/**
* Clean task after testing
* @throws Exception
*/
@After
public void tearDown() throws Exception {
//Close OpenOffice
app.close();
}
/**
......
......@@ -30,7 +30,7 @@ import static testlib.UIMap.*;
import java.io.File;
import org.junit.AfterClass;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
......@@ -43,11 +43,17 @@ public class SmokeTest {
public Log LOG = new Log();
File smoketestOutput;
@Before
public void setUp() throws Exception {
initApp(true);
smoketestOutput = new File(app.getUserInstallation(), "user/temp");
deleteFile(smoketestOutput);
app.getOpenOffice().cleanUserInstallation();
app.start();
smoketestOutput = new File(oo.getUserInstallation(), "user/temp");
}
@After
public void tearDown() throws Exception {
app.close();
}
@Test
......@@ -66,9 +72,4 @@ public class SmokeTest {
assertTrue("No Error", !smoketestlog.contains("error") && !testclosurelog.contains("error"));
}
@AfterClass
public static void afterClass() {
app.kill();
}
}
......@@ -24,14 +24,10 @@
package testcase;
import static org.openoffice.test.vcl.Tester.sleep;
import static testlib.AppUtil.fullPath;
import static testlib.AppUtil.handleBlocker;
import static testlib.AppUtil.initApp;
import static testlib.AppUtil.openStartcenter;
import static testlib.AppUtil.submitOpenDlg;
import static testlib.AppUtil.submitSaveDlg;
import static org.openoffice.test.vcl.Tester.*;
import static testlib.AppUtil.*;
import static testlib.UIMap.*;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
......@@ -121,7 +117,7 @@ public class TestSample {
*/
@Before
public void setUp() {
initApp();
app.start();
FileUtil.deleteFile(fullPath("temp"));
File temp = new File(fullPath("temp"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment