summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-01-16 09:16:12 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-01-16 09:16:12 +0000
commitcafe7442f0aaa09ed25193c450330c2f2662d9ab (patch)
tree06c0dd564e2afebe248d66ff6f9d575a0e565dd7 /vcl
parentf8ec51cc28ce8e3902ac53c6a1720a5a0ac82261 (diff)
drop old unused vcl/qa/complex tests
Change-Id: I3570b465d406921cbbb225825f9ba410161c9635
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qa/complex/memCheck/CheckMemoryUsage.java501
-rw-r--r--vcl/qa/complex/memCheck/CheckMemoryUsage.props22
-rw-r--r--vcl/qa/complex/memCheck/FileHelper.java73
-rw-r--r--vcl/qa/complex/memCheck/TestDocument.java36
-rw-r--r--vcl/qa/complex/memCheck/makefile.mk122
-rw-r--r--vcl/qa/complex/memCheck/testdocuments/CalcDoc.sxcbin9547 -> 0 bytes
-rw-r--r--vcl/qa/complex/memCheck/testdocuments/ImpressDoc.sxibin35135 -> 0 bytes
-rw-r--r--vcl/qa/complex/memCheck/testdocuments/WriterDoc.sxwbin5754 -> 0 bytes
-rw-r--r--vcl/qa/complex/persistent_window_states/DocumentHandle.java175
-rw-r--r--vcl/qa/complex/persistent_window_states/PersistentWindowTest.java361
-rw-r--r--vcl/qa/complex/persistent_window_states/PersistentWindowTest.props28
-rw-r--r--vcl/qa/complex/persistent_window_states/makefile.mk58
12 files changed, 0 insertions, 1376 deletions
diff --git a/vcl/qa/complex/memCheck/CheckMemoryUsage.java b/vcl/qa/complex/memCheck/CheckMemoryUsage.java
deleted file mode 100644
index 12e6c9bdf143..000000000000
--- a/vcl/qa/complex/memCheck/CheckMemoryUsage.java
+++ /dev/null
@@ -1,501 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package complex.memCheck;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import helper.ProcessHandler;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.FilenameFilter;
-import java.io.PrintWriter;
-import java.util.StringTokenizer;
-
-import lib.TestParameters;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.openoffice.test.OfficeConnection;
-
-import util.DesktopTools;
-import util.PropertyName;
-
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.frame.XStorable;
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.util.XCloseable;
-
-/**
- * Documents are opened and exported with StarOffice. The memory usage of
- * StarOffice is monitored and if the usage exceeds the allowed kilobytes,
- * the test is failed. Used for monitoring the StarOffice process is the
- * command line tool 'pmap', available on Solaris or Linux. This test will not
- * run on Windows.<br>Test procedure: every given document type is searched in
- * the source directory
- * Needed parameters:
- * <ul>
- * <li>"TestDocumentPath" - the path where test documents are located.</li>
- * All parameters are used for iteration over the test document path.
- * </ul>
- */
-class TempDir
-{
-
- private final String m_sTempDir;
-
- public TempDir(String _sTempDir)
- {
- m_sTempDir = _sTempDir;
- }
-
- public String getOfficeTempDir()
- {
- return m_sTempDir;
- }
-
- public String getTempDir()
- {
- final String sTempDir = FileHelper.getJavaCompatibleFilename(m_sTempDir);
- return sTempDir;
- }
-}
-
-public class CheckMemoryUsage
-{
-
- TempDir m_aTempDir;
- private String[][] sDocTypeExportFilter;
- private String[][] sDocuments;
- // the allowed memory increase measured in kByte per exported document. The default is 10 kByte.
- // the allowed memory increase per exported document: if the memory increase is higher than this number, the test will fail
- private static final int iAllowMemoryIncrease = 10;
- private int iExportDocCount = 25;
-
- /**
- * Collect all documents to load and all filters used for export.
- */
- @Before
- public void before()
- {
-
- final XMultiServiceFactory xMsf = getMSF();
-
- // some Tests need the qadevOOo TestParameters, it is like a Hashmap for Properties.
- TestParameters param = new TestParameters();
-
- // test does definitely not run on Windows.
- if (param.get(PropertyName.OPERATING_SYSTEM).equals(PropertyName.WNTMSCI))
- {
- System.out.println("Test can only reasonably be executed with a tool that "
- + "displays the memory usage of StarOffice.");
- System.out.println("Test does not run on Windows, only on Solaris or Linux.");
- // in an automatic environment it is better to say, there is no error here.
- // it is a limitation, but no error.
- System.exit(0);
- }
-
-
- // how many times is every document exported.
- // the amount of exported documents: each loaded document will be written 'ExportDocCount' times
- iExportDocCount = 25;
-
- // get the temp dir for creating the command scripts.
- m_aTempDir = new TempDir(util.utils.getOfficeTemp/*Dir*/(xMsf));
-
- // get the file extension, export filter connection
- // the import and export filters
- // store a file extension
- sDocTypeExportFilter = new String[3][2];
- sDocTypeExportFilter[0][0] = "sxw";
- sDocTypeExportFilter[0][1] = "writer_pdf_Export";
- sDocTypeExportFilter[1][0] = "sxc";
- sDocTypeExportFilter[1][1] = "calc_pdf_Export";
- sDocTypeExportFilter[2][0] = "sxi";
- sDocTypeExportFilter[2][1] = "impress_pdf_Export";
-
- // get files to load and export
- String sDocumentPath = TestDocument.getUrl();
- File f = new File(FileHelper.getJavaCompatibleFilename(sDocumentPath));
- sDocuments = new String[sDocTypeExportFilter.length][];
- for (int j = 0; j < sDocTypeExportFilter.length; j++)
- {
- FileFilter filter = new FileFilter(sDocTypeExportFilter[j][0]);
- String[] doc = f.list(filter);
- sDocuments[j] = new String[doc.length];
- for (int i = 0; i < doc.length; i++)
- {
- sDocuments[j][i] = TestDocument.getUrl(doc[i]);
- }
- }
- }
-
- /**
- * delete all created files on disk
- */
- @After
- public void after()
- {
- }
-
- /**
- * The test function: load documents and save them using the given filters
- * for each given document type.
- */
- @Test
- public void loadAndSaveDocuments() throws Exception
- {
- int nOk = 0;
- int nRunThrough = 0;
-
- // At first:
- // we load the document, there will be some post work in office like late initialisations
- // we store exact one time the document
- // so the memory footprint should be right
-
- // iterate over all document types
- for (int k = 0; k < sDocTypeExportFilter.length; k++)
- {
- // iterate over all documents of this type
- for (int i = 0; i < sDocuments[k].length; i++)
- {
-
- final String sDocument = sDocuments[k][i];
- final String sExtension = sDocTypeExportFilter[k][1];
-
- loadAndSaveNTimesDocument(sDocument, 1, sExtension);
-
- }
- System.out.println();
- System.out.println();
- }
-
- System.out.println("Wait for: " + 10000 + "ms");
- util.utils.pause(10000);
-
- // Now the real test, load document and store 25 times
-
- // iterate over all document types
- for (int k = 0; k < sDocTypeExportFilter.length; k++)
- {
- // iterate over all documents of this type
- for (int i = 0; i < sDocuments[k].length; i++)
- {
-
- final String sDocument = sDocuments[k][i];
- final String sExtension = sDocTypeExportFilter[k][1];
-
- OfficeMemchecker aChecker = new OfficeMemchecker();
- aChecker.setDocumentName(FileHelper.getBasename(sDocument));
- aChecker.setExtension(sExtension);
- aChecker.start();
-
- loadAndSaveNTimesDocument(sDocument, iExportDocCount, sExtension);
-
- aChecker.stop();
- final int nConsumMore = aChecker.getConsumMore();
-
- nOk += checkMemory(nConsumMore);
- nRunThrough++;
- }
- System.out.println();
- System.out.println();
- }
- System.out.println("Find the output of used 'pmap' here: " + m_aTempDir.getTempDir() + " if test failed.");
- assertTrue("Office consumes too many memory.", nOk == nRunThrough);
- }
-
- /**
- * Checks how much memory should consume
- * @param storageBefore
- * @return 1 if consume is ok, else 0
- */
- private int checkMemory(int nConsumMore)
- {
- int nAllowed = iAllowMemoryIncrease * iExportDocCount;
- System.out.println("The Office consumes now " + nConsumMore
- + "K more memory than at the start of the test; allowed were "
- + nAllowed + "K.");
- if (nConsumMore > nAllowed)
- {
- System.out.println("ERROR: This is not allowed.");
- return 0;
- }
- System.out.println("OK.");
- return 1;
- }
-
- /**
- * load and save exact one document
- */
- private void loadAndSaveNTimesDocument(String _sDocument, int _nCount, String _sStoreExtension) throws Exception
- {
- System.out.println("Document: " + _sDocument);
- XComponent xComponent = DesktopTools.loadDoc(getMSF(), _sDocument, null);
- XStorable xStorable = UnoRuntime.queryInterface(XStorable.class, xComponent);
- if (xStorable != null)
- {
- // export each document iExportDocCount times
- for (int j = 0; j < _nCount; j++)
- {
- final String sDocumentName = FileHelper.getBasename(_sDocument) + "_" + j + ".pdf";
- final String sFilename = FileHelper.appendPath(m_aTempDir.getOfficeTempDir(), sDocumentName);
- String url = sFilename; // graphical.FileHelper.getFileURLFromSystemPath(sFilename);
- try
- {
- PropertyValue[] props = new PropertyValue[1];
- props[0] = new PropertyValue();
- props[0].Name = "FilterName";
- // use export filter for this doc type
- props[0].Value = _sStoreExtension;
- xStorable.storeToURL(url, props);
- }
- catch (com.sun.star.io.IOException e)
- {
- fail("Could not store to '" + url + "'");
- }
- }
- // close the doc
- XCloseable xCloseable = UnoRuntime.queryInterface(XCloseable.class, xStorable);
- xCloseable.close(true);
- }
- else
- {
- System.out.println("Cannot query for XStorable interface on document '" + _sDocument + "'");
- System.out.println(" -> Skipping storage.");
- }
-
- }
-
-
- private class OfficeMemchecker
- {
-
- /**
- * After called start() it contains the memory need at startup
- */
- private int m_nMemoryStart;
- /**
- * After called stop() it contains the memory usage
- */
- private int m_nMemoryUsage;
- private String m_sDocumentName;
- private String m_sExtension;
-
- public OfficeMemchecker()
- {
- m_nMemoryStart = 0;
- }
-
- public void setDocumentName(String _sDocName)
- {
- m_sDocumentName = _sDocName;
- }
-
- public void setExtension(String _sExt)
- {
- m_sExtension = _sExt;
- }
-
- public void start()
- {
- m_nMemoryStart = getOfficeMemoryUsage(createModeName("start", 0));
- }
-
- private String createModeName(String _sSub, int _nCount)
- {
- StringBuffer aBuf = new StringBuffer();
- aBuf.append(_sSub);
- aBuf.append('_').append(m_sDocumentName).append('_').append(m_sExtension);
- aBuf.append('_').append(_nCount);
- return aBuf.toString();
- }
-
- public void stop()
- {
- // short wait for the office to 'calm down' and free some memory
- System.out.println("Wait for: " + 20000 + "ms");
- util.utils.pause(20000);
- // wait util memory is not freed anymore.
- int storageAfter = getOfficeMemoryUsage(createModeName("stop", 0));
- int mem = 0;
- int count = 0;
- while (storageAfter != mem && count < 10)
- {
- count++;
- mem = storageAfter;
- storageAfter = getOfficeMemoryUsage(createModeName("stop", count));
- System.out.println("Wait for: " + 1000 + "ms");
- util.utils.pause(1000);
- }
- m_nMemoryUsage = (storageAfter - m_nMemoryStart);
- }
-
- public int getConsumMore()
- {
- return m_nMemoryUsage;
- }
-
- /**
- * Get the process ID from the Office
- * @return the Id as String
- */
- private String getOfficeProcessID()
- {
- String sProcessIdCommand = FileHelper.appendPath(m_aTempDir.getTempDir(), "getPS");
- final String sofficeArg = org.openoffice.test.Argument.get("soffice");
- final String sPSGrep = "ps -ef | grep $USER | grep <soffice>.bin | grep -v grep";
- final String sProcessId = sPSGrep.replaceAll("<soffice>", FileHelper.getJavaCompatibleFilename(sofficeArg));
-
- createExecutableFile(sProcessIdCommand, sProcessId);
- ProcessHandler processID = new ProcessHandler(sProcessIdCommand);
- processID.noOutput();
- processID.executeSynchronously();
- String text = processID.getOutputText();
- if (text == null || text.equals("") || text.indexOf(' ') == -1)
- {
- fail("Could not determine Office process ID. Check " + sProcessIdCommand);
- }
- StringTokenizer aToken = new StringTokenizer(text);
- // this is not nice, but ps gives the same output on every machine
- aToken.nextToken();
- String id = aToken.nextToken();
- return id;
- }
-
- /**
- * Get the memory usage of the Office in KByte.
- * @return The memory used by the Office.
- */
- private int getOfficeMemoryUsage(String _sMode)
- {
- final String sMemoryMonitor = "pmap <processID> |tee <pmapoutputfile> | grep total";
- String sOfficeMemoryCommand = null;
- sOfficeMemoryCommand = FileHelper.appendPath(m_aTempDir.getTempDir(), "getPmap");
- String command = sMemoryMonitor.replaceAll("<processID>", getOfficeProcessID());
- String sPmapOutputFile = FileHelper.appendPath(m_aTempDir.getTempDir(), "pmap_" + _sMode + ".txt");
- command = command.replaceAll("<pmapoutputfile>", sPmapOutputFile);
- createExecutableFile(sOfficeMemoryCommand, command);
-
- ProcessHandler processID = new ProcessHandler(sOfficeMemoryCommand);
- processID.noOutput();
- processID.executeSynchronously();
- int nError = processID.getExitCode();
- assertTrue("Execute of " + sOfficeMemoryCommand + " failed", nError == 0);
- String text = processID.getOutputText();
- if (text == null || text.equals("") || text.indexOf(' ') == -1)
- {
- fail("Could not determine Office memory usage. Check " + sOfficeMemoryCommand);
- }
- StringTokenizer aToken = new StringTokenizer(text);
- // this works, because the output of pmap is quite standardized.
- aToken.nextToken();
- String mem = aToken.nextToken();
- mem = mem.substring(0, mem.indexOf('K'));
- Integer memory = Integer.valueOf(mem);
- return memory.intValue();
- }
-
- /**
- * Write a script file and set its rights to rwxrwxrwx.
- * @param fileName The name of the created file
- * @param line The commandline that has to be written inside of the file.
- */
- private void createExecutableFile(String fileName, String line)
- {
- final String sChmod = "chmod a+x ";
- final String bash = "#!/bin/bash";
-
- try
- {
- String sFilename = FileHelper.getJavaCompatibleFilename(fileName);
- PrintWriter fWriter = new PrintWriter(new FileWriter(sFilename));
- fWriter.println(bash);
- fWriter.println(line);
- fWriter.close();
- // change rights to rwxrwxrwx
- ProcessHandler processID = new ProcessHandler(sChmod + sFilename);
- processID.noOutput();
- processID.executeSynchronously();
- int nError = processID.getExitCode();
- assertTrue("chmod failed. ", nError == 0);
- }
- catch (java.io.IOException e)
- {
- }
- }
- }
-
- /**
- * Own file filter, will just return ok for all files that end with a given
- * suffix
- */
- private class FileFilter implements FilenameFilter
- {
-
- private final String suffix;
-
- /**
- * C'tor.
- * @param suffix The suffix each filename should end with.
- */
- public FileFilter(String suffix)
- {
- this.suffix = suffix;
- }
-
- /**
- * Returns true, if the name of the file has the suffix given to the
- * c'tor.
- * @param name The filename that is tested.
- * @param file Not used.
- * @return True, if name ends with suffix.
- */
- public boolean accept(File file, String name)
- {
- return name.endsWith(suffix);
- }
- }
-
- private XMultiServiceFactory getMSF()
- {
- return UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
- }
-
- // setup and close connections
- @BeforeClass
- public static void setUpConnection() throws Exception
- {
- System.out.println("setUpConnection()");
- connection.setUp();
- }
-
- @AfterClass
- public static void tearDownConnection()
- throws InterruptedException, com.sun.star.uno.Exception
- {
- System.out.println("tearDownConnection()");
- connection.tearDown();
- }
- private static final OfficeConnection connection = new OfficeConnection();
-}
diff --git a/vcl/qa/complex/memCheck/CheckMemoryUsage.props b/vcl/qa/complex/memCheck/CheckMemoryUsage.props
deleted file mode 100644
index 3ff90b54f2ef..000000000000
--- a/vcl/qa/complex/memCheck/CheckMemoryUsage.props
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This file incorporates work covered by the following license notice:
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed
-# with this work for additional information regarding copyright
-# ownership. The ASF licenses this file to you under the Apache
-# License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-
-# the path to the test documents
-TestDocumentPath=../../testdocuments
-
-
diff --git a/vcl/qa/complex/memCheck/FileHelper.java b/vcl/qa/complex/memCheck/FileHelper.java
deleted file mode 100644
index d4517502b2ce..000000000000
--- a/vcl/qa/complex/memCheck/FileHelper.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package complex.memCheck;
-
-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
- 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 "";
- }
-
- int nIdx = _sFilename.lastIndexOf("\\");
- if (nIdx == -1)
- {
- nIdx = _sFilename.lastIndexOf("/");
- }
- if (nIdx > 0)
- {
- return _sFilename.substring(nIdx + 1);
- }
- return _sFilename;
- }
-}
diff --git a/vcl/qa/complex/memCheck/TestDocument.java b/vcl/qa/complex/memCheck/TestDocument.java
deleted file mode 100644
index 7e299b8ae75f..000000000000
--- a/vcl/qa/complex/memCheck/TestDocument.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-package complex.memCheck;
-
-import java.io.File;
-import org.openoffice.test.OfficeFileUrl;
-
-final class TestDocument
-{
- private static final 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() {}
-}
diff --git a/vcl/qa/complex/memCheck/makefile.mk b/vcl/qa/complex/memCheck/makefile.mk
deleted file mode 100644
index 58af47f56e27..000000000000
--- a/vcl/qa/complex/memCheck/makefile.mk
+++ /dev/null
@@ -1,122 +0,0 @@
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This file incorporates work covered by the following license notice:
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed
-# with this work for additional information regarding copyright
-# ownership. The ASF licenses this file to you under the Apache
-# License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-
-.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
-nothing .PHONY:
-.ELSE
-
-PRJ = ../../..
-PRJNAME = vcl
-TARGET = qa_complex_memCheck
-
-.IF "$(OOO_JUNIT_JAR)" != ""
-PACKAGE = complex/memCheck
-
-# here store only Files which contain a @Test
-JAVATESTFILES = \
- CheckMemoryUsage.java
-
-# put here all other files
-JAVAFILES = $(JAVATESTFILES) \
- FileHelper.java \
- TestDocument.java
-
-
-JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar
-EXTRAJARFILES = $(OOO_JUNIT_JAR)
-
-# Sample how to debug
-# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y
-
-.END
-
-.INCLUDE: settings.mk
-.INCLUDE: target.mk
-.INCLUDE: installationtest.mk
-
-ALLTAR : javatest
-
-.END
-
-
-
-#
-#
-#
-# 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
diff --git a/vcl/qa/complex/memCheck/testdocuments/CalcDoc.sxc b/vcl/qa/complex/memCheck/testdocuments/CalcDoc.sxc
deleted file mode 100644
index 4b2b572085dc..000000000000
--- a/vcl/qa/complex/memCheck/testdocuments/CalcDoc.sxc
+++ /dev/null
Binary files differ
diff --git a/vcl/qa/complex/memCheck/testdocuments/ImpressDoc.sxi b/vcl/qa/complex/memCheck/testdocuments/ImpressDoc.sxi
deleted file mode 100644
index efcdf9b6a25e..000000000000
--- a/vcl/qa/complex/memCheck/testdocuments/ImpressDoc.sxi
+++ /dev/null
Binary files differ
diff --git a/vcl/qa/complex/memCheck/testdocuments/WriterDoc.sxw b/vcl/qa/complex/memCheck/testdocuments/WriterDoc.sxw
deleted file mode 100644
index 1b2c2cb2dab6..000000000000
--- a/vcl/qa/complex/memCheck/testdocuments/WriterDoc.sxw
+++ /dev/null
Binary files differ
diff --git a/vcl/qa/complex/persistent_window_states/DocumentHandle.java b/vcl/qa/complex/persistent_window_states/DocumentHandle.java
deleted file mode 100644
index 470b144116df..000000000000
--- a/vcl/qa/complex/persistent_window_states/DocumentHandle.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package complex.persistent_window_states;
-
-
-import com.sun.star.awt.PosSize;
-import com.sun.star.awt.Rectangle;
-import com.sun.star.awt.WindowEvent;
-import com.sun.star.awt.XWindow;
-import com.sun.star.beans.PropertyState;
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.frame.FrameSearchFlag;
-import com.sun.star.frame.XComponentLoader;
-import com.sun.star.frame.XFrame;
-import com.sun.star.lang.EventObject;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.uno.UnoRuntime;
-
-/**
- * Load and resize a document.
- *
- */
-public class DocumentHandle {
- // the component loader to load a document
- private final XComponentLoader xCompLoader;
-
- // the current window
- private XWindow xWin = null;
- // a own window listener
- private final MyWindowListener wl;
-
- /**
- * Constructor
- * @param xCompLoader A loader to load a document
- */
- public DocumentHandle(XComponentLoader xCompLoader) {
- this.xCompLoader = xCompLoader;
- wl = new MyWindowListener();
- }
-
- /**
- * Load/Create a document.
- * @param docName The name of a document as file URL
- * @param hidden If true, the document is loaded hidden.
- * @return The size of the opened/created document.
- */
- public Rectangle loadDocument(XMultiServiceFactory xMSF, String docName, boolean hidden)
- throws Exception{
- wl.resizedTrigger = false;
- try {
- PropertyValue [] szArgs = null;
- if (hidden) {
- szArgs = new PropertyValue [1];
- PropertyValue Arg = new PropertyValue();
- Arg.Name = "Hidden";
- Arg.Value = hidden?"True":"False";
- Arg.Handle = -1;
- Arg.State = PropertyState.DEFAULT_VALUE;
- szArgs[0] = Arg;
- }
- else {
- szArgs = new PropertyValue [0];
- }
-
- // get the current active window
- XFrame xCurFrame = UnoRuntime.queryInterface(XFrame.class, xCompLoader);
-
- // create a new frame
- XFrame xFrame = xCurFrame.findFrame("_blank", FrameSearchFlag.CREATE);
-
- // load document in this frame
- XComponentLoader xFrameLoader = UnoRuntime.queryInterface(XComponentLoader.class, xFrame);
- xFrameLoader.loadComponentFromURL(docName, "_self", 0, szArgs);
- // wait for the document to load.
- util.utils.waitForEventIdle(xMSF);
-
- xWin = xFrame.getContainerWindow();
- xWin.addWindowListener(wl);
- }
- catch(com.sun.star.io.IOException e) {
- e.printStackTrace();
- return null;
- }
- catch(com.sun.star.lang.IllegalArgumentException e) {
- e.printStackTrace();
- return null;
- }
- catch(java.lang.Exception e) {
- System.out.println("DH3");
- e.printStackTrace();
- throw e;
- }
- return xWin.getPosSize();
-
- }
-
- /**
- * Get the size of the current window.
- * @return The size of the window as Rectangle.
- */
- public Rectangle getDocumentPosSize() {
- return xWin.getPosSize();
- }
-
- /**
- * Resize the window in defined steps:
- * width -10 pixel;
- * height -10 pixel;
- * X-Position +10 pixel;
- * Y-Position +10 pixel
- * @return True if resize worked.
- */
- public boolean resizeDocument(XMultiServiceFactory xMSF) {
- Rectangle newPosSize = xWin.getPosSize();
- newPosSize.Width = newPosSize.Width - 20;
- newPosSize.Height = newPosSize.Height - 20;
- newPosSize.X = newPosSize.X + 80;
- newPosSize.Y = newPosSize.Y + 80;
- return resizeDocument(xMSF, newPosSize);
- }
-
- /**
- * Resize window to the given Rectangle
- * @param newPosSize The new position and size of the window.
- * @return True if resize worked.
- */
- private boolean resizeDocument(XMultiServiceFactory xMSF, Rectangle newPosSize){
- wl.resizedTrigger = false;
- xWin.setPosSize(newPosSize.X, newPosSize.Y, newPosSize.Width,
- newPosSize.Height, PosSize.POSSIZE);
- util.utils.waitForEventIdle(xMSF);
- return wl.resizedTrigger;
- }
-
- private static class MyWindowListener implements com.sun.star.awt.XWindowListener {
- // resize called
- public boolean resizedTrigger = false;
-
- @Override
- public void disposing(EventObject eventObject) {
- }
-
- @Override
- public void windowHidden(EventObject eventObject) {
- }
-
- @Override
- public void windowMoved(WindowEvent eventObject) {
- }
-
- @Override
- public void windowResized(WindowEvent eventObject) {
- resizedTrigger = true;
- }
-
- @Override
- public void windowShown(EventObject eventObject) {
- }
- }
-}
diff --git a/vcl/qa/complex/persistent_window_states/PersistentWindowTest.java b/vcl/qa/complex/persistent_window_states/PersistentWindowTest.java
deleted file mode 100644
index 04938f435962..000000000000
--- a/vcl/qa/complex/persistent_window_states/PersistentWindowTest.java
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package complex.persistent_window_states;
-
-import com.sun.star.uno.Any;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.frame.XFramesSupplier;
-import com.sun.star.frame.XFrames;
-import com.sun.star.container.XIndexAccess;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.AnyConverter;
-import com.sun.star.frame.XComponentLoader;
-import com.sun.star.awt.Rectangle;
-import com.sun.star.util.XCloseable;
-import helper.ConfigurationRead;
-
-
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.openoffice.test.OfficeConnection;
-import static org.junit.Assert.*;
-
-/**
- * Parameters:
- * <ul>
- * <li>NoOffice=yes - StarOffice is not started initially.</li>
- * </ul>
- */
-public class PersistentWindowTest
-{
-
-
- /**
- * Test if all available document types change the
- * persistent Window Attributes
- *
- * The test follows basically these steps:
- * - Create a configuration reader and a componentloader
- * - Look for all document types in the configuration
- * - Do for every doc type
- * - start office
- * - read configuration attibute settings
- * - create a new document
- * - resize the document and close it
- * - close office
- * - start office
- * - read configuration attribute settings
- * - create another new document
- * - compare old settings with new ones: should be different
- * - compare the document size with the resized document: should be equal
- * - close office
- * - Test finished
- */
- @Test public void checkPersistentWindowState()
- {
- try
- {
-
- // just test the wrong ones, not all.
- String[] els = new String[]
- {
- "Office/Factories/com.sun.star.drawing.DrawingDocument",
- "Office/Factories/com.sun.star.formula.FormulaProperties",
- "Office/Factories/com.sun.star.sheet.SpreadsheetDocument",
- "Office/Factories/com.sun.star.text.GlobalDocument",
- "Office/Factories/com.sun.star.text.TextDocument",
- "Office/Factories/com.sun.star.text.WebDocument",
- };
- // uncomment the following line for all doc types
- // String [] els = cfgRead.getSubNodeNames("Office/Factories");
-
- System.out.println("Found " + els.length + " document types to test.\n");
- disconnect();
-
- // for all types
- for (int i = 0; i < els.length; i++)
- {
- System.out.println("\tStart test for document type " + i + ": " + els[i]);
- // exclude chart documents: cannot be created this way.
- if (els[i].indexOf("ChartDocument") != -1)
- {
- System.out.println("Skipping chart document: cannot be create like this.");
- continue;
- }
-
- // start an office
- connect();
-
- // get configuration
- String[] settings = getConfigurationAndLoader(getMSF(), els[i]);
- if (settings == null)
- {
- System.out.println("Skipping document type " + els[i]);
- disconnect();
- continue;
- }
- String cfg = settings[1];
-
- // load a document
- DocumentHandle handle = loadDocument(getMSF(), settings[0]);
-
- // first size
- Rectangle rect1 = handle.getDocumentPosSize();
-
- // resize
- handle.resizeDocument(getMSF());
- // after resize
- Rectangle rect2 = handle.getDocumentPosSize();
-
- // disposeManager and start a new office
- disconnect();
-
- connect();
-
- // get configuration
- settings = getConfigurationAndLoader(getMSF(), els[i]);
-
- String newCfg = settings[1];
-
- // load a document
- handle = loadDocument(getMSF(), settings[0]);
-
- Rectangle newRect = handle.getDocumentPosSize();
-
- // print the settings and window sizes
- System.out.println("----------------------------");
- System.out.println("Initial Config String : " + cfg);
- System.out.println("Config String after restart: " + newCfg);
-
- System.out.println("----------------------------");
- System.out.println("Initial window (X,Y,Width,Height): "
- + rect1.X + ";" + rect1.Y + ";" + rect1.Width + ";" + rect1.Height);
- System.out.println("Window after resize (X,Y,Width,Height): "
- + rect2.X + ";" + rect2.Y + ";" + rect2.Width + ";" + rect2.Height);
- System.out.println("Window after restart (X,Y,Width,Height): "
- + newRect.X + ";" + newRect.Y + ";" + newRect.Width + ";"
- + newRect.Height);
-
- // compare to see if resize worked
- System.out.println("----------------------------");
- if (els[i].indexOf("SpreadsheetDocument") == -1 &&
- els[i].indexOf("DrawingDocument") == -1)
- {
- // leave out Spreadsheet- and DrawingDocumnt
- assertTrue("Resize values for " + els[i] + " are equal.", !compareRectangles(rect1, rect2));
- }
- // compare settings and sizes
- assertTrue("Config settings for " + els[i] + " were not changed.", !cfg.equals(newCfg));
- assertTrue("Resized and restarted window for " + els[i] + " are not equal.", compareRectangles(rect2, newRect));
- System.out.println("----------------------------");
-
- // disposeManager
- disconnect();
-
- System.out.println("\tFinish test for document type " + i + ": " + els[i]);
-
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- /**
- * Get the configuration settings and the document loader
- * @param xMSF A MultiServiceFactory from an office
- * @param cfgString A configuration string
- * @return Settings and Loader
- */
- private static String[] getConfigurationAndLoader(XMultiServiceFactory xMSF,
- String cfgString)
- {
- String[] conf = new String[2];
-
- try
- {
- Object o = xMSF.createInstance(
- "com.sun.star.configuration.ConfigurationProvider");
-
- // fetch the multi service factory for setup
- XMultiServiceFactory xCP = UnoRuntime.queryInterface(XMultiServiceFactory.class, o);
-
- // create the configuration reader
- ConfigurationRead cfgRead = new ConfigurationRead(xCP);
-
- // get the document loader
- String loader = getStringFromObject(
- cfgRead.getByHierarchicalName(cfgString + "/ooSetupFactoryEmptyDocumentURL"));
-
- if (loader == null)
- {
- return null;
- }
- System.out.println("\tLoader: " + loader);
-
- // read attributes
- String hierchName = cfgString + "/ooSetupFactoryWindowAttributes";
- String setupSettings = getStringFromObject(cfgRead.getByHierarchicalName(hierchName));
- // remove slots: just plain document types have to start
- if (loader.indexOf("?slot") != -1)
- {
- loader = loader.substring(0, loader.indexOf("?slot"));
- System.out.println("Loader: " + loader);
- }
-
- conf[0] = loader;
- conf[1] = setupSettings;
- }
- catch (com.sun.star.uno.Exception e)
- {
- }
- return conf;
- }
-
- /**
- * Load a document
- * @param xMSF A MultiServiceFactory from an office
- * @param docLoader A document loader
- * @return A handle to the document
- */
- private DocumentHandle loadDocument(XMultiServiceFactory xMSF,
- String docLoader)
- {
- DocumentHandle docHandle = null;
- try
- {
- // create component loader
- XComponentLoader xCompLoader = UnoRuntime.queryInterface(XComponentLoader.class, xMSF.createInstance("com.sun.star.frame.Desktop"));
- XFramesSupplier xFrameSupp = UnoRuntime.queryInterface(XFramesSupplier.class, xCompLoader);
- // close all existing frames
- XFrames xFrames = xFrameSupp.getFrames();
- XIndexAccess xAcc = UnoRuntime.queryInterface(XIndexAccess.class, xFrames);
- for (int i = 0; i < xAcc.getCount(); i++)
- {
- XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xAcc.getByIndex(i));
- try
- {
- if (xClose != null)
- {
- xClose.close(false);
- }
- else
- {
- fail("Could not query frame for XCloseable!");
- }
- }
- catch (com.sun.star.uno.Exception e)
- {
- e.printStackTrace();
- fail("Could not query frame for XCloseable!");
- }
- }
- docHandle = new DocumentHandle(xCompLoader);
- docHandle.loadDocument(xMSF, docLoader, false);
- }
- catch (com.sun.star.uno.Exception e)
- {
- e.printStackTrace();
- }
- catch (java.lang.Exception e)
- {
- e.printStackTrace();
- }
- return docHandle;
- }
-
- private boolean connect() throws Exception
- {
- connection.setUp();
- return true;
- }
-
- private boolean disconnect() throws Exception
- {
- connection.tearDown();
- return true;
- }
-
- private static String getStringFromObject(Object oName)
- {
- if (oName instanceof String)
- {
- return (String) oName;
- }
- String value = null;
- if (oName instanceof Any)
- {
- try
- {
- value = AnyConverter.toString(oName);
- if (value == null)
- {
- System.out.println("Got a void css.uno.Any as loading string.");
- }
- }
- catch (Exception e)
- {
- System.out.println("This document type cannot be opened directly.");
- }
- }
- return value;
- }
-
- /**
- * Compare two rectangles. Return true, if both are equal, false
- * otherwise.
- * @param rect1 First Rectangle.
- * @param rect2 Second Rectangle.
- * @return True, if the rectangles are equal.
- */
- private boolean compareRectangles(Rectangle rect1, Rectangle rect2)
- {
- boolean result = true;
- result &= (rect1.X == rect2.X);
- result &= (rect1.Y == rect2.Y);
- result &= (rect1.Width == rect2.Width);
- result &= (rect1.Height == rect2.Height);
- return result;
- }
-
-
-
- private XMultiServiceFactory getMSF()
- {
- return UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
- }
-
- // setup and close connections
- @BeforeClass public static void setUpConnection() throws Exception {
- System.out.println("setUpConnection()");
- connection.setUp();
- }
-
- @AfterClass public static void tearDownConnection()
- throws InterruptedException, com.sun.star.uno.Exception
- {
- System.out.println("tearDownConnection()");
- connection.tearDown();
- }
-
- private static final OfficeConnection connection = new OfficeConnection();
-
-}
diff --git a/vcl/qa/complex/persistent_window_states/PersistentWindowTest.props b/vcl/qa/complex/persistent_window_states/PersistentWindowTest.props
deleted file mode 100644
index 2105dae6672f..000000000000
--- a/vcl/qa/complex/persistent_window_states/PersistentWindowTest.props
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This file incorporates work covered by the following license notice:
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed
-# with this work for additional information regarding copyright
-# ownership. The ASF licenses this file to you under the Apache
-# License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-
-# test can be long: so increase the time until the test is interrupted
-# time in milliseconds
-ThreadTimeOut=50000000
-
-# wait for the Office to close: may be increased on slower machines
-# time in milliseconds
-OfficeCloseTime=5000
-
-# do not start an Office initially
-NoOffice=yes
diff --git a/vcl/qa/complex/persistent_window_states/makefile.mk b/vcl/qa/complex/persistent_window_states/makefile.mk
deleted file mode 100644
index 709979017e7f..000000000000
--- a/vcl/qa/complex/persistent_window_states/makefile.mk
+++ /dev/null
@@ -1,58 +0,0 @@
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-# This file incorporates work covered by the following license notice:
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed
-# with this work for additional information regarding copyright
-# ownership. The ASF licenses this file to you under the Apache
-# License, Version 2.0 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.apache.org/licenses/LICENSE-2.0 .
-#
-.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
-nothing .PHONY:
-.ELSE
-
-PRJ = ../../..
-PRJNAME = vcl
-TARGET = qa_complex_persistent_window_states
-
-.IF "$(OOO_JUNIT_JAR)" != ""
-PACKAGE = complex/persistent_window_states
-
-# here store only Files which contain a @Test
-JAVATESTFILES = \
- PersistentWindowTest.java
-
-# put here all other files
-JAVAFILES = $(JAVATESTFILES) \
-DocumentHandle.java
-
-
-JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar
-EXTRAJARFILES = $(OOO_JUNIT_JAR)
-
-# Sample how to debug
-# JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y
-
-.END
-
-.INCLUDE: settings.mk
-.INCLUDE: target.mk
-.INCLUDE: installationtest.mk
-
-ALLTAR : javatest
-
-.END
-
-
-
-
-
-