Kaydet (Commit) b7f52d9a authored tarafından Lars Langhans's avatar Lars Langhans

sb123:#i111449# cleanups in vcl qa/complex tests

üst 69309ccb
...@@ -48,3 +48,9 @@ vc vcl\mac\source\src nmake - m vc__srcm vc_inc NULL ...@@ -48,3 +48,9 @@ vc vcl\mac\source\src nmake - m vc__srcm vc_inc NULL
vc vcl\util nmake - all vc_util vc__plug.u vc__desk.u vc__aquy.u vc__appa.u vc__dtra.u vc__appm.m vc__appu.u vc__dtru.u vc__appw.w vc__appp.p vc__gdia.u vc__gdim.m vc__gdiu.u vc__gdiw.w vc__gdip.p vc__srcm.m vc__srcw.w vc__srcp.p vc__wina.u vc__winm.m vc__winu.u vc__winw.w vc__winp.p vc__gtka.u vc__gtky.u vc__gtkw.u vc__gtkg.u vc__kde.u vc__kde4.u vc__hl.u vc__ftmu.u vc__prgu.u vc__prnu.u vc_app vc_ctrl vc_gdi vc_hlp vc_src vc_win vc_glyphs vc_fts vc_components NULL vc vcl\util nmake - all vc_util vc__plug.u vc__desk.u vc__aquy.u vc__appa.u vc__dtra.u vc__appm.m vc__appu.u vc__dtru.u vc__appw.w vc__appp.p vc__gdia.u vc__gdim.m vc__gdiu.u vc__gdiw.w vc__gdip.p vc__srcm.m vc__srcw.w vc__srcp.p vc__wina.u vc__winm.m vc__winu.u vc__winw.w vc__winp.p vc__gtka.u vc__gtky.u vc__gtkw.u vc__gtkg.u vc__kde.u vc__kde4.u vc__hl.u vc__ftmu.u vc__prgu.u vc__prnu.u vc_app vc_ctrl vc_gdi vc_hlp vc_src vc_win vc_glyphs vc_fts vc_components NULL
vc vcl\util\linksvp nmake - u vc_lsvp vc_util NULL vc vcl\util\linksvp nmake - u vc_lsvp vc_util NULL
vc vcl\workben nmake - all vc_wrkb vc_util vc_salmain NULL vc vcl\workben nmake - all vc_wrkb vc_util vc_salmain NULL
# memCheck works only within unix
# memCheck is not right yet
# vc vcl\qa\complex\memCheck nmake - u vc_qa_complex vc_util NULL
vc vcl\qa\complex\persistent_window_states nmake - all vc_qa_complex vc_util NULL
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
package complex.memCheck;
import java.io.File;
/**
*
* @author ll93751
*/
public class FileHelper
{
public static String appendPath(String _sPath, String _sRelativePathToAdd)
{
String sNewPath = _sPath;
String fs = System.getProperty("file.separator");
if (_sPath.startsWith("file:"))
{
fs = "/"; // we use a file URL so only '/' is allowed.
}
if (! (sNewPath.endsWith("/") || sNewPath.endsWith("\\") ) )
{
sNewPath += fs;
}
sNewPath += _sRelativePathToAdd;
return sNewPath;
}
public static String getJavaCompatibleFilename(String _sFilename)
{
// It is a little bit stupid that office urls not compatible to java file urls
// System.out.println("java.io.File can't access Office file urls.");
if(_sFilename.startsWith("path:"))
{
final String sPath = _sFilename.substring(5);
return sPath;
}
String sSystemPath = graphical.FileHelper.getSystemPathFromFileURL(_sFilename);
if (sSystemPath == null)
{
sSystemPath = _sFilename;
}
return sSystemPath;
}
public static String getBasename(String _sFilename)
{
if (_sFilename == null)
{
return "";
}
// String fs = System.getProperty("file.separator");
int nIdx = _sFilename.lastIndexOf("\\");
if (nIdx == -1)
{
nIdx = _sFilename.lastIndexOf("/");
}
if (nIdx > 0)
{
return _sFilename.substring(nIdx + 1);
}
return _sFilename;
}
}
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
package complex.memCheck;
import java.io.File;
import org.openoffice.test.OfficeFileUrl;
final class TestDocument
{
final static String sPathname = "testdocuments";
public static String getUrl(String name)
{
return OfficeFileUrl.getAbsolute(new File(sPathname, name));
}
public static String getUrl()
{
return OfficeFileUrl.getAbsolute(new File(sPathname));
}
private TestDocument() {}
}
...@@ -25,65 +25,111 @@ ...@@ -25,65 +25,111 @@
# #
#************************************************************************* #*************************************************************************
PRJ = ..$/..$/.. .IF "$(OOO_SUBSEQUENT_TESTS)" == ""
TARGET = MemoryCheck nothing .PHONY:
PRJNAME = $(TARGET) @echo "OOO_SUBSEQUENT_TESTS not set, do nothing."
PACKAGE = complex$/memCheck .ELSE
# --- Settings -----------------------------------------------------
.INCLUDE: settings.mk
#----- compile .java files -----------------------------------------
JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
JAVAFILES = CheckMemoryUsage.java
#----- make a jar from compiled files ------------------------------
MAXLINELENGTH = 100000
JARCLASSDIRS = $(PACKAGE) PRJ = ../../..
JARTARGET = $(TARGET).jar PRJNAME = vcl
JARCOMPRESS = TRUE TARGET = qa_complex_memCheck
# --- Parameters for the test -------------------------------------- .IF "$(OOO_JUNIT_JAR)" != ""
PACKAGE = complex/memCheck
# start an office if the parameter is set for the makefile # here store only Files which contain a @Test
.IF "$(OFFICE)" == "" JAVATESTFILES = \
CT_APPEXECCOMMAND = CheckMemoryUsage.java
.ELSE
CT_APPEXECCOMMAND = -AppExecutionCommand \
"$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;"
.ENDIF
# test base is java complex # put here all other files
CT_TESTBASE = -TestBase java_complex JAVAFILES = $(JAVATESTFILES) \
FileHelper.java \
TestDocument.java
# replace $/ with . in package name
CT_PACKAGE = -o $(PACKAGE:s\$/\.\)
# start the runner application JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar
CT_APP = org.openoffice.Runner EXTRAJARFILES = $(OOO_JUNIT_JAR)
# --- Targets ------------------------------------------------------ # subdirectories
# SUBDIRS = helper
.IF "$(depend)" == "" # Sample how to debug
$(CLASSDIR)$/$(PACKAGE)$/CheckMemoryUsage.props : ALLTAR # JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y
.ELSE
$(CLASSDIR)$/$(PACKAGE)$/CheckMemoryUsage.props : ALLTAR
.ENDIF
.INCLUDE : target.mk .END
.INCLUDE: settings.mk
.INCLUDE: target.mk
.INCLUDE: installationtest.mk
ALLTAR : javatest
$(CLASSDIR)$/$(PACKAGE)$/CheckMemoryUsage.props : CheckMemoryUsage.props .END
cp $(@:f) $@
jar uf $(CLASSDIR)$/$(JARTARGET) -C $(CLASSDIR) $(PACKAGE)$/$(@:f)
RUN: run
run: #
java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_PACKAGE).CheckMemoryUsage #
#
# PRJ = ..$/..$/..
# TARGET = MemoryCheck
# PRJNAME = $(TARGET)
# PACKAGE = complex$/memCheck
#
# # --- Settings -----------------------------------------------------
# .INCLUDE: settings.mk
#
#
# #----- compile .java files -----------------------------------------
#
# JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
# JAVAFILES = CheckMemoryUsage.java
#
# #----- make a jar from compiled files ------------------------------
#
# MAXLINELENGTH = 100000
#
# JARCLASSDIRS = $(PACKAGE)
# JARTARGET = $(TARGET).jar
# JARCOMPRESS = TRUE
#
# # --- Parameters for the test --------------------------------------
#
# # start an office if the parameter is set for the makefile
# .IF "$(OFFICE)" == ""
# CT_APPEXECCOMMAND =
# .ELSE
# CT_APPEXECCOMMAND = -AppExecutionCommand \
# "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;"
# .ENDIF
#
# # test base is java complex
# CT_TESTBASE = -TestBase java_complex
#
# # replace $/ with . in package name
# CT_PACKAGE = -o $(PACKAGE:s\$/\.\)
#
# # start the runner application
# CT_APP = org.openoffice.Runner
#
# # --- Targets ------------------------------------------------------
#
# .IF "$(depend)" == ""
# $(CLASSDIR)$/$(PACKAGE)$/CheckMemoryUsage.props : ALLTAR
# .ELSE
# $(CLASSDIR)$/$(PACKAGE)$/CheckMemoryUsage.props : ALLTAR
# .ENDIF
#
# .INCLUDE : target.mk
#
#
#
# $(CLASSDIR)$/$(PACKAGE)$/CheckMemoryUsage.props : CheckMemoryUsage.props
# cp $(@:f) $@
# jar uf $(CLASSDIR)$/$(JARTARGET) -C $(CLASSDIR) $(PACKAGE)$/$(@:f)
#
#
# RUN: run
#
# run:
# java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_PACKAGE).CheckMemoryUsage
...@@ -34,13 +34,9 @@ import com.sun.star.lang.XComponent; ...@@ -34,13 +34,9 @@ import com.sun.star.lang.XComponent;
import com.sun.star.awt.XWindow; import com.sun.star.awt.XWindow;
import com.sun.star.beans.PropertyValue; import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.PropertyState; import com.sun.star.beans.PropertyState;
import com.sun.star.frame.XController;
import com.sun.star.frame.FrameSearchFlag;
import com.sun.star.text.XTextDocument;
import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.UnoRuntime;
import com.sun.star.frame.XFrame; import com.sun.star.frame.XFrame;
import com.sun.star.frame.FrameSearchFlag; import com.sun.star.frame.FrameSearchFlag;
import com.sun.star.frame.XFramesSupplier;
import helper.WindowListener; import helper.WindowListener;
/** /**
...@@ -59,7 +55,7 @@ public class DocumentHandle { ...@@ -59,7 +55,7 @@ public class DocumentHandle {
/** /**
* Constructor * Constructor
* @param xComponentLoader A loader to load a document * @param xCompLoader A loader to load a document
*/ */
public DocumentHandle(XComponentLoader xCompLoader) { public DocumentHandle(XComponentLoader xCompLoader) {
this.xCompLoader = xCompLoader; this.xCompLoader = xCompLoader;
...@@ -71,6 +67,7 @@ public class DocumentHandle { ...@@ -71,6 +67,7 @@ public class DocumentHandle {
* @param docName The name of a document as file URL * @param docName The name of a document as file URL
* @param hidden If true, the document is loaded hidden. * @param hidden If true, the document is loaded hidden.
* @return The size of the opened/created document. * @return The size of the opened/created document.
* @throws Exception
*/ */
public Rectangle loadDocument(String docName, boolean hidden) public Rectangle loadDocument(String docName, boolean hidden)
throws Exception{ throws Exception{
...@@ -91,13 +88,13 @@ public class DocumentHandle { ...@@ -91,13 +88,13 @@ public class DocumentHandle {
} }
// get the current active window // get the current active window
XFrame xCurFrame = (XFrame)UnoRuntime.queryInterface(XFrame.class, xCompLoader); XFrame xCurFrame = UnoRuntime.queryInterface(XFrame.class, xCompLoader);
// create a new frame // create a new frame
XFrame xFrame = xCurFrame.findFrame("_blank", FrameSearchFlag.CREATE); XFrame xFrame = xCurFrame.findFrame("_blank", FrameSearchFlag.CREATE);
// load document in this frame // load document in this frame
XComponentLoader xFrameLoader = (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class, xFrame); XComponentLoader xFrameLoader = UnoRuntime.queryInterface(XComponentLoader.class, xFrame);
xComp = xFrameLoader.loadComponentFromURL( xComp = xFrameLoader.loadComponentFromURL(
docName, "_self", 0, szArgs); docName, "_self", 0, szArgs);
// wait for the document to load. // wait for the document to load.
......
...@@ -24,58 +24,48 @@ ...@@ -24,58 +24,48 @@
# for a copy of the LGPLv3 License. # for a copy of the LGPLv3 License.
# #
#************************************************************************* #*************************************************************************
.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
nothing .PHONY:
@echo "OOO_SUBSEQUENT_TESTS not set, do nothing."
.ELSE
PRJ = ..$/..$/.. PRJ = ../../..
TARGET = PersistentWindowTest PRJNAME = vcl
PRJNAME = $(TARGET) TARGET = qa_complex_persistent_window_states
PACKAGE = complex$/persistent_window_states
# --- Settings ----------------------------------------------------- .IF "$(OOO_JUNIT_JAR)" != ""
.INCLUDE: settings.mk PACKAGE = complex/persistent_window_states
#----- compile .java files ----------------------------------------- # here store only Files which contain a @Test
JAVATESTFILES = \
PersistentWindowTest.java
JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar # put here all other files
JAVAFILES = PersistentWindowTest.java DocumentHandle.java JAVAFILES = $(JAVATESTFILES) \
DocumentHandle.java
#----- make a jar from compiled files ------------------------------
MAXLINELENGTH = 100000 JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar
EXTRAJARFILES = $(OOO_JUNIT_JAR)
JARCLASSDIRS = $(PACKAGE) # subdirectories
JARTARGET = $(TARGET).jar # SUBDIRS = helper
JARCOMPRESS = TRUE
# --- Parameters for the test -------------------------------------- # Sample how to debug
JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y
# test base is java complex .END
CT_TESTBASE = -TestBase java_complex
# test looks something like the.full.package.TestName .INCLUDE: settings.mk
CT_TEST = -o $(PACKAGE:s\$/\.\).$(TARGET) .INCLUDE: target.mk
.INCLUDE: installationtest.mk
# start the runner application ALLTAR : javatest
CT_APP = org.openoffice.Runner
# --- Targets ------------------------------------------------------ .END
$(CLASSDIR)$/$(PACKAGE)$/$(TARGET).props : ALLTAR
.INCLUDE : target.mk
$(CLASSDIR)$/$(PACKAGE)$/$(TARGET).props : $(TARGET).props
cp $(TARGET).props $@
jar uf $(CLASSDIR)$/$(JARTARGET) -C $(CLASSDIR) $(PACKAGE)$/$(TARGET).props
RUN: run
# start an office if the parameter is set for the makefile
.IF "$(OFFICE)" == ""
run:
@echo "Execute this test with 'dmake run OFFICE=/system/path/to/office/program'."
@echo "The office will be started by the test with a socket connection on port 8100"
.ELSE
run: $(CLASSDIR)$/$(PACKAGE)$/$(TARGET).props
java -cp $(CLASSPATH) $(CT_APP) -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" $(CT_TESTBASE) $(CT_TEST)
.ENDIF
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