summaryrefslogtreecommitdiff
path: root/qadevOOo
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2009-09-07 16:59:04 +0000
committerOliver Bolte <obo@openoffice.org>2009-09-07 16:59:04 +0000
commit2015a96eb08ebff09861df75f273e78bb80fbcac (patch)
treefe94e8623fb34988253f9ecd1deec309f2c0fda0 /qadevOOo
parent8741d0f3cd6bd3123a12787a57745f2d94f06aee (diff)
CWS-TOOLING: integrate CWS qadev38
2009-08-26 09:09:14 +0200 lla r275394 : #i104497# fix broken unoapi tests 2009-08-25 15:16:34 +0200 lla r275362 : #i102426# OfficePriver fix 2009-08-25 15:14:19 +0200 lla r275361 : #i104496# cleanups
Diffstat (limited to 'qadevOOo')
-rw-r--r--qadevOOo/runner/base/java_fat.java29
-rw-r--r--qadevOOo/runner/graphical/IniFile.java2
-rw-r--r--qadevOOo/runner/graphical/JPEGComparator.java30
-rw-r--r--qadevOOo/runner/graphical/JPEGCreator.java107
-rw-r--r--qadevOOo/runner/graphical/PixelCounter.java58
-rw-r--r--qadevOOo/runner/helper/APIDescGetter.java60
-rw-r--r--qadevOOo/runner/helper/OfficeProvider.java20
-rw-r--r--qadevOOo/runner/lib/MultiPropertyTest.java331
-rw-r--r--qadevOOo/runner/lib/TestParameters.java4
-rw-r--r--qadevOOo/runner/org/openoffice/Runner.java2
-rw-r--r--qadevOOo/runner/util/DesktopTools.java8
11 files changed, 471 insertions, 180 deletions
diff --git a/qadevOOo/runner/base/java_fat.java b/qadevOOo/runner/base/java_fat.java
index 0e540cf97..22f16eac1 100644
--- a/qadevOOo/runner/base/java_fat.java
+++ b/qadevOOo/runner/base/java_fat.java
@@ -279,7 +279,7 @@ public class java_fat implements TestBase
tEnv = getEnv(entry, param);
}
- MultiMethodTest ifc = null;
+ // MultiMethodTest ifc = null;
lib.TestResult res = null;
// run the interface test twice if it failed.
@@ -319,17 +319,7 @@ public class java_fat implements TestBase
}
}
}
- if (res != null)
- {
- for (int k = 0; k < aSubEntry.SubEntryCount; k++)
- {
- DescEntry aSubSubEntry = aSubEntry.SubEntries[k];
- if (res.hasMethod( aSubSubEntry.entryName))
- {
- aSubSubEntry.State = res.getStatusFor(aSubSubEntry.entryName).toString();
- }
- }
- }
+ setState(aSubEntry, res);
sumIt.summarizeUp(aSubEntry);
@@ -386,6 +376,21 @@ public class java_fat implements TestBase
return retValue;
}
+ private void setState(DescEntry aSubEntry, lib.TestResult res)
+ {
+ if (res != null)
+ {
+ for (int k = 0; k < aSubEntry.SubEntryCount; k++)
+ {
+ DescEntry aSubSubEntry = aSubEntry.SubEntries[k];
+ if (res.hasMethod( aSubSubEntry.entryName))
+ {
+ aSubSubEntry.State = res.getStatusFor(aSubSubEntry.entryName).toString();
+ }
+ }
+ }
+ }
+
private TestEnvironment getEnv(DescEntry entry, TestParameters param)
{
// if (dcl == null)
diff --git a/qadevOOo/runner/graphical/IniFile.java b/qadevOOo/runner/graphical/IniFile.java
index d375ac5ca..6b1371575 100644
--- a/qadevOOo/runner/graphical/IniFile.java
+++ b/qadevOOo/runner/graphical/IniFile.java
@@ -99,7 +99,7 @@ public class IniFile implements Enumeration
while (aLine != null)
{
aLine = aReader.readLine();
- if (aLine != null)
+ if (aLine != null && aLine.length() > 0)
{
aLines.add(aLine);
}
diff --git a/qadevOOo/runner/graphical/JPEGComparator.java b/qadevOOo/runner/graphical/JPEGComparator.java
index 701dc534f..06fa30bc1 100644
--- a/qadevOOo/runner/graphical/JPEGComparator.java
+++ b/qadevOOo/runner/graphical/JPEGComparator.java
@@ -160,10 +160,9 @@ public class JPEGComparator extends EnhancedComplexTestCase
assure("File '" + sJPEGFilename + "' doesn't exists.", aFile.exists(), true);
if (aFile.exists())
{
+ GlobalLogWriter.println("Page: " + i);
checkOnePicture(sJPEGFilename, _sResult, _aParams);
}
-
-
}
}
else
@@ -513,14 +512,20 @@ public class JPEGComparator extends EnhancedComplexTestCase
* between old and new graphics. The font of the new graphics is little bit bigger,
* so the pixel count between old graphics and new graphics is twice the more.
*
+ * @param _sOldGfx path & name to the jpeg file (1)
+ * @param _sNewGfx path & name to the other jpeg file (2)
+ * @param _sDiffGfx path & name to the new difference file which shows the difference between (1) and (2)
+ * @return the count of different pixels
+ * @throws java.io.IOException if file access is not possible
*/
- public int estimateGfx(String _sOldGfx, String _sNewGfx, String _sDiffGfx)
+
+ public static int estimateGfx(String _sOldGfx, String _sNewGfx, String _sDiffGfx)
throws java.io.IOException
{
// new count pixels
- int nNotWhiteCount_OldGraphic = PixelCounter.countNotWhitePixelsFromImage(_sOldGfx);
- int nNotWhiteCount_NewGraphic = PixelCounter.countNotWhitePixelsFromImage(_sNewGfx);
- int nNotBlackCount_DiffGraphic = PixelCounter.countNotBlackPixelsFromImage(_sDiffGfx);
+ final int nNotWhiteCount_OldGraphic = PixelCounter.countNotWhitePixelsFromImage(_sOldGfx);
+ final int nNotWhiteCount_NewGraphic = PixelCounter.countNotWhitePixelsFromImage(_sNewGfx);
+ final int nNotBlackCount_DiffGraphic = PixelCounter.countNotBlackPixelsFromImage(_sDiffGfx);
int nMinNotWhiteCount = Math.min(nNotWhiteCount_NewGraphic, nNotWhiteCount_OldGraphic);
@@ -539,7 +544,7 @@ public class JPEGComparator extends EnhancedComplexTestCase
return nPercent;
}
- public int compareJPEG(String _sOldGfx, String _sNewGfx, String _sDiffGfx)
+ private static int compareJPEG(String _sOldGfx, String _sNewGfx, String _sDiffGfx)
{
String sComposite = "composite";
if (OSHelper.isWindows())
@@ -571,6 +576,15 @@ public class JPEGComparator extends EnhancedComplexTestCase
String sBack = aHandler.getOutputText();
GlobalLogWriter.get().println("'" + sBack + "'");
}
+ else
+ {
+ // creates an extra smaller difference picture
+ File aDiffFile = new File(_sDiffGfx);
+ if (aDiffFile.exists())
+ {
+ JPEGCreator.convertToNearSameFileWithWidth340(_sDiffGfx);
+ }
+ }
return nExitCode;
}
@@ -624,7 +638,7 @@ public class JPEGComparator extends EnhancedComplexTestCase
}
catch(java.lang.NumberFormatException e)
{
- GlobalLogWriter.get().println("Number format exception");
+ GlobalLogWriter.get().println("identify(): Number format exception");
nResult = 0;
}
return nResult;
diff --git a/qadevOOo/runner/graphical/JPEGCreator.java b/qadevOOo/runner/graphical/JPEGCreator.java
index 5e5c681f0..5b78976d6 100644
--- a/qadevOOo/runner/graphical/JPEGCreator.java
+++ b/qadevOOo/runner/graphical/JPEGCreator.java
@@ -76,6 +76,8 @@ public class JPEGCreator extends EnhancedComplexTestCase
int nPages = countPages(sJPEGNameSchema);
if (nPages > 0)
{
+ createSmallPictures(sJPEGNameSchema);
+
String sIndexFile = FileHelper.appendPath(_sResult, "index.ini");
File aIndexFile = new File(sIndexFile);
if (aIndexFile.exists())
@@ -89,7 +91,110 @@ public class JPEGCreator extends EnhancedComplexTestCase
}
}
}
-
+
+/**
+ * Create a lot of smaller and nicer Pictures of the big fat pages.
+ * Looks better
+ * @param _sJPEGSchema
+ */
+ public void createSmallPictures(String _sJPEGSchema)
+ {
+ int nPages = 0;
+ if (_sJPEGSchema.length() > 0)
+ {
+ // TODO: if there doesn't exists a '%04d' in the schema we will return 9999 which is a little bit wrong here.
+ for (int i=1;i<10000;i++)
+ {
+ String sJPEGFilename = getFilenameForJPEGSchema(_sJPEGSchema, i);
+ if (FileHelper.exists(sJPEGFilename))
+ {
+ convertToNearSameFileWithWidth340(sJPEGFilename);
+ // m_aFileList.add(sNewJPEGFilename); // as long as the files exist, fill the array
+ nPages ++;
+ }
+ else
+ {
+ break; // stop file check
+ }
+ }
+ }
+ // return nPages;
+ }
+
+/**
+ * convert a picture to a new picture with 340 pixel width.
+ * @param _sJPEGFilename
+ */
+public static void convertToNearSameFileWithWidth340(String _sJPEGFilename)
+{
+ String sNewJPEGFilename;
+ sNewJPEGFilename = util.utils.replaceAll13(_sJPEGFilename, ".jpg", "_w340.jpg");
+ convertToWidth340(_sJPEGFilename, sNewJPEGFilename);
+}
+
+ /**
+ * convert chart2_Regression.ods.ps_180DPI_0001.jpg -filter Catrom -resize
+340x chart2_Regression.ods.ps_180DPI_0001_w340.jpg
+
+Point wie bisher
+Cubic schlecht, weil unscharf
+...
+Triangle ganz brauchbar (default?)
+Catrom am besten
+
+ * @param _sFrom
+ * @param _To
+ */
+private static void convertToWidth340(String _sFrom, String _To)
+{
+ // int nResult = 0;
+
+ String sConvertEXE = "convert";
+ if (OSHelper.isLinuxIntel())
+ {
+ sConvertEXE = "convert";
+ }
+ if (OSHelper.isWindows())
+ {
+ sConvertEXE = "convert.exe";
+ }
+
+ String[] sCommandArray =
+ {
+ sConvertEXE,
+ _sFrom,
+ "-filter", "Catrom",
+ "-resize", "340x",
+ _To
+ };
+ ProcessHandler aHandler = new ProcessHandler(sCommandArray);
+ boolean bBackValue = aHandler.executeSynchronously();
+ int nExitCode = aHandler.getExitCode();
+
+ String sBack = aHandler.getOutputText();
+ if (sBack.length() > 0)
+ {
+ GlobalLogWriter.get().println("'" + sBack + "'");
+ }
+ // try to interpret the result, which we get as a String
+// try
+// {
+// int nIdx = sBack.indexOf("\n");
+// if (nIdx > 0)
+// {
+// sBack = sBack.substring(0, nIdx);
+// }
+//
+// nResult = Integer.valueOf(sBack).intValue();
+// }
+// catch(java.lang.NumberFormatException e)
+// {
+// GlobalLogWriter.get().println("Number format exception");
+// nResult = 0;
+// }
+ // return nResult;
+}
+
/**
* create out of a given Postscript/PDF _sFile a list of JPEGs, one for every page
* @param _sFile
diff --git a/qadevOOo/runner/graphical/PixelCounter.java b/qadevOOo/runner/graphical/PixelCounter.java
index 38dbac8f0..0e3f54409 100644
--- a/qadevOOo/runner/graphical/PixelCounter.java
+++ b/qadevOOo/runner/graphical/PixelCounter.java
@@ -34,7 +34,7 @@ package graphical;
// -----------------------------------------------------------------------------
abstract class CountPixel
{
- int m_nCount = 0;
+ protected int m_nCount = 0;
public int getCount() {return m_nCount;}
public abstract void count(int _nRGB);
}
@@ -47,9 +47,9 @@ class CountNotWhite extends CountPixel
// System.out.println("CountWhite()");
}
- public void count(final int pixel)
+ public void countold(final int pixel)
{
- final int alpha = (pixel >> 24) & 0xff;
+ // final int alpha = (pixel >> 24) & 0xff;
final int red = (pixel >> 16) & 0xff;
final int green = (pixel >> 8) & 0xff;
final int blue = (pixel ) & 0xff;
@@ -61,6 +61,28 @@ class CountNotWhite extends CountPixel
}
++m_nCount;
}
+ public void count(final int pixel)
+ {
+ // final int alpha = (pixel >> 24) & 0xff;
+ final int blue = (pixel ) & 0xff;
+ if (blue != 0xff)
+ {
+ ++m_nCount;
+ return;
+ }
+ final int green = (pixel >> 8) & 0xff;
+ if (green != 0xff)
+ {
+ ++m_nCount;
+ return;
+ }
+ final int red = (pixel >> 16) & 0xff;
+ if (red != 0xff)
+ {
+ ++m_nCount;
+ return;
+ }
+ }
}
// -----------------------------------------------------------------------------
@@ -71,9 +93,9 @@ class CountNotBlack extends CountPixel
// System.out.println("CountBlack()");
}
- public void count(final int pixel)
+ public void countold(final int pixel)
{
- final int alpha = (pixel >> 24) & 0xff;
+ // final int alpha = (pixel >> 24) & 0xff;
final int red = (pixel >> 16) & 0xff;
final int green = (pixel >> 8) & 0xff;
final int blue = (pixel ) & 0xff;
@@ -84,6 +106,28 @@ class CountNotBlack extends CountPixel
}
++m_nCount;
}
+ public void count(final int pixel)
+ {
+ // final int alpha = (pixel >> 24) & 0xff;
+ final int blue = (pixel ) & 0xff;
+ if (blue != 0x00)
+ {
+ ++m_nCount;
+ return;
+ }
+ final int green = (pixel >> 8) & 0xff;
+ if (green != 0x00)
+ {
+ ++m_nCount;
+ return;
+ }
+ final int red = (pixel >> 16) & 0xff;
+ if (red != 0x00)
+ {
+ ++m_nCount;
+ return;
+ }
+ }
}
// -----------------------------------------------------------------------------
@@ -157,7 +201,7 @@ public class PixelCounter {
throws java.io.IOException
{
ImageHelper aImage = ImageHelper.createImageHelper(_sFile);
- int nw = graphics_stuff.countNotWhitePixel(aImage);
+ final int nw = graphics_stuff.countNotWhitePixel(aImage);
return nw;
}
@@ -165,7 +209,7 @@ public class PixelCounter {
throws java.io.IOException
{
ImageHelper aImage = ImageHelper.createImageHelper(_sFile);
- int nw = graphics_stuff.countNotBlackPixel(aImage);
+ final int nw = graphics_stuff.countNotBlackPixel(aImage);
return nw;
}
diff --git a/qadevOOo/runner/helper/APIDescGetter.java b/qadevOOo/runner/helper/APIDescGetter.java
index cce776434..c007d6d20 100644
--- a/qadevOOo/runner/helper/APIDescGetter.java
+++ b/qadevOOo/runner/helper/APIDescGetter.java
@@ -326,7 +326,6 @@ public class APIDescGetter extends DescGetter
// String meth_name = line.substring(line.lastIndexOf(";") + 2, line.length() - 1);
DescEntry methDesc = createDescEntry(meth_name, ifc_name, parent);
- meth_names.add(methDesc);
if (!ifc_name.equals(old_ifc_name))
{
@@ -365,37 +364,13 @@ public class APIDescGetter extends DescGetter
ifc_name = ifc_name.substring(0, ifc_name.indexOf("#"));
}
- StringTokenizer st = new StringTokenizer(ifc_name, ":");
- String className = "";
-
- int count = 3;
-
- if (ifc_name.startsWith("drafts"))
- {
- count = 4;
- }
-
- for (int i = 0; st.hasMoreTokens(); i++)
- {
- String token = st.nextToken();
-
- // skipping (drafts.)com.sun.star
- if (i >= count)
- {
- if (!st.hasMoreTokens())
- {
- // inserting '_' before the last token
- token = "_" + token;
- }
-
- className += ("." + token);
- }
- }
+ String className = createClassName(ifc_name);
ifcDesc.EntryType = entryType;
ifcDesc.entryName = "ifc" + className;
ifcDesc.longName = parent.entryName + "::" + ifc_name;
}
+ meth_names.add(methDesc);
}
catch (java.io.IOException ioe)
@@ -430,6 +405,37 @@ public class APIDescGetter extends DescGetter
return getDescArray(makeArray(ifc_names));
}
+ private static String createClassName(String _ifc_name)
+ {
+ StringTokenizer st = new StringTokenizer(_ifc_name, ":");
+ String className = "";
+
+ int count = 3;
+
+ if (_ifc_name.startsWith("drafts"))
+ {
+ count = 4;
+ }
+
+ for (int i = 0; st.hasMoreTokens(); i++)
+ {
+ String token = st.nextToken();
+
+ // skipping (drafts.)com.sun.star
+ if (i >= count)
+ {
+ if (!st.hasMoreTokens())
+ {
+ // inserting '_' before the last token
+ token = "_" + token;
+ }
+
+ className += ("." + token);
+ }
+ }
+ return className;
+ }
+
private static String entryType;
private static DescEntry createDescEntry(String meth_name, String ifc_name, DescEntry parent)
diff --git a/qadevOOo/runner/helper/OfficeProvider.java b/qadevOOo/runner/helper/OfficeProvider.java
index 101681103..4c4e07d8e 100644
--- a/qadevOOo/runner/helper/OfficeProvider.java
+++ b/qadevOOo/runner/helper/OfficeProvider.java
@@ -91,6 +91,7 @@ public class OfficeProvider implements AppProvider
OfficeWatcherPing owp = new OfficeWatcherPing((OfficeWatcher) param.get(PropertyName.OFFICE_WATCHER));
owp.start();
+ deleteFilesAndDirector (new File(copyLayer));
FileTools.copyDirectory(new File(userLayer), new File(copyLayer), new String[]
{
"temp"
@@ -581,6 +582,7 @@ public class OfficeProvider implements AppProvider
final String copyLayer = (String) param.get("copyLayer");
if (userLayer != null && copyLayer != null)
{
+ deleteFilesAndDirector(new File(userLayer));
final File copyFile = new File(copyLayer);
dbg("copy '" + copyFile + "' -> '" + userLayer + "'");
FileTools.copyDirectory(copyFile, new File(userLayer), new String[]
@@ -823,4 +825,22 @@ public class OfficeProvider implements AppProvider
}
}
}
+
+private void deleteFilesAndDirector(File file)
+ {
+ File f = file;
+ if(f.isDirectory())
+ {
+ File files[] = f.listFiles();
+ for(int i = 0; i < files.length; i++)
+ {
+ deleteFilesAndDirector(files[i]);
+ }
+ f.delete();
+ }
+ else if (f.isFile())
+ {
+ f.delete();
+ }
+ }
}
diff --git a/qadevOOo/runner/lib/MultiPropertyTest.java b/qadevOOo/runner/lib/MultiPropertyTest.java
index eca10a8fa..234a7ca04 100644
--- a/qadevOOo/runner/lib/MultiPropertyTest.java
+++ b/qadevOOo/runner/lib/MultiPropertyTest.java
@@ -27,7 +27,6 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
package lib;
import com.sun.star.beans.Property;
@@ -71,7 +70,9 @@ import com.sun.star.uno.Type;
* @see #compare
* @see #toString(Object)
*/
-public class MultiPropertyTest extends MultiMethodTest {
+public class MultiPropertyTest extends MultiMethodTest
+{
+
/**
* Contains a XPropertySet interface of the tested object. Is initialized
* in MultiMethodTest code.
@@ -82,18 +83,23 @@ public class MultiPropertyTest extends MultiMethodTest {
/**
* Overrides super.before() to check the service is supported by the object.
*/
- protected void before() {
- XServiceInfo xInfo = (XServiceInfo)UnoRuntime.queryInterface(
+ protected void before()
+ {
+ XServiceInfo xInfo = (XServiceInfo) UnoRuntime.queryInterface(
XServiceInfo.class, oObj);
-
+
optionalService = entry.isOptional;
String theService = getTestedClassName();
- if (xInfo != null && !xInfo.supportsService(theService)) {
- log.println("Service "+theService+" not available");
- if (optionalService) {
+ if (xInfo != null && !xInfo.supportsService(theService))
+ {
+ log.println("Service " + theService + " not available");
+ if (optionalService)
+ {
log.println("This is OK since it is optional");
- } else {
+ }
+ else
+ {
Status.failed(theService + " is not supported");
}
}
@@ -107,10 +113,14 @@ public class MultiPropertyTest extends MultiMethodTest {
*
* @see #MultiMethodTest.invokeTestMethod()
*/
- protected void invokeTestMethod(Method meth, String methName) {
- if (meth != null) {
+ protected void invokeTestMethod(Method meth, String methName)
+ {
+ if (meth != null)
+ {
super.invokeTestMethod(meth, methName);
- } else {
+ }
+ else
+ {
testProperty(methName);
}
}
@@ -122,7 +132,9 @@ public class MultiPropertyTest extends MultiMethodTest {
* each property separately, by providing subclass of PropertyTester
* and passing it to testProperty(String, PropertyTester method).
*/
- public class PropertyTester {
+ public class PropertyTester
+ {
+
/**
* The method defines the whole process of testing propName
* property.
@@ -140,37 +152,46 @@ public class MultiPropertyTest extends MultiMethodTest {
* @result - adds the result of testing propName property to
* MultiMethodTest.tRes.
*/
- protected void testProperty(String propName) {
+ protected void testProperty(String propName)
+ {
XPropertySetInfo info = oObj.getPropertySetInfo();
- if (!info.hasPropertyByName(propName)) {
- if (isOptional(propName) || optionalService) {
- // skipping optional property test
- log.println("Property '" + propName
- + "' is optional and not supported");
- tRes.tested(propName,true);
- return;
- } else {
- // cannot test the property
- log.println("Tested XPropertySet does not contain'"
- + propName + "' property");
- tRes.tested(propName, false);
- return;
+ if (info != null)
+ {
+ if (!info.hasPropertyByName(propName))
+ {
+ if (isOptional(propName) || optionalService)
+ {
+ // skipping optional property test
+ log.println("Property '" + propName + "' is optional and not supported");
+ tRes.tested(propName, true);
+ return;
+ }
+ else
+ {
+ // cannot test the property
+ log.println("Tested XPropertySet does not contain'" + propName + "' property");
+ tRes.tested(propName, false);
+ return;
+ }
}
}
- try {
+ try
+ {
Object oldValue = oObj.getPropertyValue(propName);
Object newValue;
// trying to create new value
- try {
+ try
+ {
newValue = getNewValue(propName, oldValue);
- } catch (java.lang.IllegalArgumentException e) {
+ }
+ catch (java.lang.IllegalArgumentException e)
+ {
// skipping test since new value is not available
- Status.failed("Cannot create new value for '"
- + propName + " : " + e.getMessage());
+ Status.failed("Cannot create new value for '" + propName + " : " + e.getMessage());
return;
}
@@ -178,20 +199,31 @@ public class MultiPropertyTest extends MultiMethodTest {
// to pass it to checkResult method
Exception exception = null;
- try {
+ try
+ {
log.println("try to set:");
log.println("old = " + toString(oldValue));
log.println("new = " + toString(newValue));
oObj.setPropertyValue(propName, newValue);
- } catch(IllegalArgumentException e) {
+ }
+ catch (IllegalArgumentException e)
+ {
exception = e;
- } catch(PropertyVetoException e) {
+ }
+ catch (PropertyVetoException e)
+ {
exception = e;
- } catch(WrappedTargetException e) {
+ }
+ catch (WrappedTargetException e)
+ {
exception = e;
- } catch(UnknownPropertyException e) {
+ }
+ catch (UnknownPropertyException e)
+ {
exception = e;
- } catch(RuntimeException e) {
+ }
+ catch (RuntimeException e)
+ {
exception = e;
}
@@ -200,7 +232,9 @@ public class MultiPropertyTest extends MultiMethodTest {
// checking results
checkResult(propName, oldValue, newValue, resValue, exception);
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
log.println("Exception occured while testing property '" + propName + "'");
e.printStackTrace(log);
tRes.tested(propName, false);
@@ -234,130 +268,175 @@ public class MultiPropertyTest extends MultiMethodTest {
*/
protected void checkResult(String propName, Object oldValue,
Object newValue, Object resValue, Exception exception)
- throws Exception {
+ throws Exception
+ {
XPropertySetInfo info = oObj.getPropertySetInfo();
+ if (info == null)
+ {
+ log.println("Can't get XPropertySetInfo for property " + propName);
+ tRes.tested(propName, false);
+ return;
+ }
Property prop = info.getPropertyByName(propName);
short attr = prop.Attributes;
- boolean readOnly = (prop.Attributes
- & PropertyAttribute.READONLY) != 0;
- boolean maybeVoid = (prop.Attributes
- & PropertyAttribute.MAYBEVOID) != 0;
+ boolean readOnly = (prop.Attributes & PropertyAttribute.READONLY) != 0;
+ boolean maybeVoid = (prop.Attributes & PropertyAttribute.MAYBEVOID) != 0;
//check get-set methods
- if (maybeVoid) log.println("Property "+propName+" is void");
- if (readOnly) log.println("Property "+propName+" is readOnly");
- if (util.utils.isVoid(oldValue) && !maybeVoid) {
- log.println(propName
- + " is void, but it's not MAYBEVOID");
+ if (maybeVoid)
+ {
+ log.println("Property " + propName + " is void");
+ }
+ if (readOnly)
+ {
+ log.println("Property " + propName + " is readOnly");
+ }
+ if (util.utils.isVoid(oldValue) && !maybeVoid)
+ {
+ log.println(propName + " is void, but it's not MAYBEVOID");
tRes.tested(propName, false);
- } else if (oldValue == null ) {
- log.println(propName
- + " has null value, and therefore can't be changed");
+ }
+ else if (oldValue == null)
+ {
+ log.println(propName + " has null value, and therefore can't be changed");
tRes.tested(propName, true);
- } else if (readOnly) {
+ }
+ else if (readOnly)
+ {
// check if exception was thrown
- if (exception != null) {
- if (exception instanceof PropertyVetoException) {
+ if (exception != null)
+ {
+ if (exception instanceof PropertyVetoException)
+ {
// the change of read only prohibited - OK
log.println("Property is ReadOnly and wasn't changed");
log.println("Property '" + propName + "' OK");
tRes.tested(propName, true);
- } else if (exception instanceof IllegalArgumentException) {
+ }
+ else if (exception instanceof IllegalArgumentException)
+ {
// the change of read only prohibited - OK
log.println("Property is ReadOnly and wasn't changed");
log.println("Property '" + propName + "' OK");
tRes.tested(propName, true);
- } else if (exception instanceof UnknownPropertyException) {
+ }
+ else if (exception instanceof UnknownPropertyException)
+ {
// the change of read only prohibited - OK
log.println("Property is ReadOnly and wasn't changed");
log.println("Property '" + propName + "' OK");
tRes.tested(propName, true);
- }else if (exception instanceof RuntimeException) {
+ }
+ else if (exception instanceof RuntimeException)
+ {
// the change of read only prohibited - OK
log.println("Property is ReadOnly and wasn't changed");
log.println("Property '" + propName + "' OK");
tRes.tested(propName, true);
- } else {
+ }
+ else
+ {
throw exception;
}
- } else {
+ }
+ else
+ {
// if no exception - check that value
// has not changed
- if (!compare(resValue, oldValue)) {
- log.println("Read only property '"
- + propName + "' has changed");
- try {
- if (!util.utils.isVoid(oldValue)
- && oldValue instanceof Any) {
- oldValue = AnyConverter.toObject
- (new Type(((Any)oldValue).getClass()),oldValue);
+ if (!compare(resValue, oldValue))
+ {
+ log.println("Read only property '" + propName + "' has changed");
+ try
+ {
+ if (!util.utils.isVoid(oldValue) && oldValue instanceof Any)
+ {
+ oldValue = AnyConverter.toObject(new Type(((Any) oldValue).getClass()), oldValue);
}
// log.println("old = " + toString(oldValue));
// log.println("new = " + toString(newValue));
log.println("result = " + toString(resValue));
- } catch(com.sun.star.lang.IllegalArgumentException iae) {
+ }
+ catch (com.sun.star.lang.IllegalArgumentException iae)
+ {
log.println("NOTIFY: this property needs further investigations.");
log.println("\t The type seems to be an Any with value of NULL.");
log.println("\t Maybe the property should get it's own test method.");
}
-
+
tRes.tested(propName, false);
- } else {
- log.println("Read only property '"
- + propName + "' hasn't changed");
+ }
+ else
+ {
+ log.println("Read only property '" + propName + "' hasn't changed");
log.println("Property '" + propName + "' OK");
tRes.tested(propName, true);
}
}
- } else {
- if (exception == null) {
+ }
+ else
+ {
+ if (exception == null)
+ {
// if no exception thrown
// check that the new value is set
- if ((!compare(resValue, newValue)) || (compare(resValue, oldValue))) {
- log.println("Value for '" + propName
- + "' hasn't changed as expected");
- try {
- if (!util.utils.isVoid(oldValue)
- && oldValue instanceof Any) {
- oldValue = AnyConverter.toObject
- (new Type(((Any)oldValue).getClass()),oldValue);
+ if ((!compare(resValue, newValue)) || (compare(resValue, oldValue)))
+ {
+ log.println("Value for '" + propName + "' hasn't changed as expected");
+ try
+ {
+ if (!util.utils.isVoid(oldValue) && oldValue instanceof Any)
+ {
+ oldValue = AnyConverter.toObject(new Type(((Any) oldValue).getClass()), oldValue);
}
// log.println("old = " + toString(oldValue));
// log.println("new = " + toString(newValue));
log.println("result = " + toString(resValue));
- } catch(com.sun.star.lang.IllegalArgumentException iae) {
+ }
+ catch (com.sun.star.lang.IllegalArgumentException iae)
+ {
log.println("NOTIFY: this property needs further investigations.");
log.println("\t The type seems to be an Any with value of NULL.");
log.println("\t Maybe the property should get it's own test method.");
- }
- if (resValue != null ) {
- if ( (!compare(resValue, oldValue)) || (!resValue.equals(oldValue))) {
+ }
+ if (resValue != null)
+ {
+ if ((!compare(resValue, oldValue)) || (!resValue.equals(oldValue)))
+ {
log.println("But it has changed.");
tRes.tested(propName, true);
- } else {
+ }
+ else
+ {
tRes.tested(propName, false);
}
}
- else {
+ else
+ {
tRes.tested(propName, false);
}
//tRes.tested(propName, false);
- } else {
+ }
+ else
+ {
log.println("Property '" + propName + "' OK");
- try {
- if (!util.utils.isVoid(oldValue)
- && oldValue instanceof Any) {
- oldValue = AnyConverter.toObject
- (new Type(((Any)oldValue).getClass()),oldValue);
+ try
+ {
+ if (!util.utils.isVoid(oldValue) && oldValue instanceof Any)
+ {
+ oldValue = AnyConverter.toObject(new Type(((Any) oldValue).getClass()), oldValue);
}
// log.println("old = " + toString(oldValue));
// log.println("new = " + toString(newValue));
log.println("result = " + toString(resValue));
- } catch(com.sun.star.lang.IllegalArgumentException iae) {
+ }
+ catch (com.sun.star.lang.IllegalArgumentException iae)
+ {
}
tRes.tested(propName, true);
}
- } else {
+ }
+ else
+ {
throw exception;
}
}
@@ -371,7 +450,8 @@ public class MultiPropertyTest extends MultiMethodTest {
* when oldValue is null.
*/
protected Object getNewValue(String propName, Object oldValue)
- throws java.lang.IllegalArgumentException {
+ throws java.lang.IllegalArgumentException
+ {
return ValueChanger.changePValue(oldValue);
}
@@ -382,7 +462,8 @@ public class MultiPropertyTest extends MultiMethodTest {
* which is not apropriate in some cases(e.g., structs with equals
* not overridden).
*/
- protected boolean compare(Object obj1, Object obj2) {
+ protected boolean compare(Object obj1, Object obj2)
+ {
return callCompare(obj1, obj2);
}
@@ -391,7 +472,8 @@ public class MultiPropertyTest extends MultiMethodTest {
* MultipropertyTest.toString(Object), but subclasses can override
* to change the behaviour.
*/
- protected String toString(Object obj) {
+ protected String toString(Object obj)
+ {
return callToString(obj);
}
}
@@ -402,9 +484,11 @@ public class MultiPropertyTest extends MultiMethodTest {
* class returns one of these two values depending on the
* old value, so new value is not equal to old value.
*/
- public class PropertyValueSwitcher extends PropertyTester {
- Object val1 = null ;
- Object val2 = null ;
+ public class PropertyValueSwitcher extends PropertyTester
+ {
+
+ Object val1 = null;
+ Object val2 = null;
/**
* Constructs a property tester with two different values
@@ -415,9 +499,10 @@ public class MultiPropertyTest extends MultiMethodTest {
* @param val1 Not <code>null</code> value for the property
* tested which differs from the first value.
*/
- public PropertyValueSwitcher(Object val1, Object val2) {
- this.val1 = val1 ;
- this.val2 = val2 ;
+ public PropertyValueSwitcher(Object val1, Object val2)
+ {
+ this.val1 = val1;
+ this.val2 = val2;
}
/**
@@ -427,18 +512,24 @@ public class MultiPropertyTest extends MultiMethodTest {
* @return The second value if old value is equal to the first
* one, the first value otherwise.
*/
- protected Object getNewValue(String propName, Object old) {
+ protected Object getNewValue(String propName, Object old)
+ {
if (ValueComparer.equalValue(val1, old))
- return val2 ;
+ {
+ return val2;
+ }
else
- return val1 ;
+ {
+ return val1;
+ }
}
}
/**
* The method performs testing of propName property using propTester.
*/
- protected void testProperty(String propName, PropertyTester propTester) {
+ protected void testProperty(String propName, PropertyTester propTester)
+ {
propTester.testProperty(propName);
}
@@ -446,7 +537,8 @@ public class MultiPropertyTest extends MultiMethodTest {
* The method performs testing of propName property. It uses PropertyTester
* instance for testing.
*/
- protected void testProperty(String propName) {
+ protected void testProperty(String propName)
+ {
testProperty(propName, new PropertyTester());
}
@@ -456,7 +548,8 @@ public class MultiPropertyTest extends MultiMethodTest {
*
* @see #PropertyValueSwitcher
*/
- protected void testProperty(String propName, Object val1, Object val2) {
+ protected void testProperty(String propName, Object val1, Object val2)
+ {
testProperty(propName, new PropertyValueSwitcher(val1, val2));
}
@@ -464,14 +557,16 @@ public class MultiPropertyTest extends MultiMethodTest {
* The method just calls compare. This is a workaround to CodeWarrior's
* compiler bug.
*/
- private boolean callCompare(Object obj1, Object obj2) {
+ private boolean callCompare(Object obj1, Object obj2)
+ {
return compare(obj1, obj2);
}
/**
* Compares two object. In the implementation calls obj1.equals(obj2).
*/
- protected boolean compare(Object obj1, Object obj2) {
+ protected boolean compare(Object obj1, Object obj2)
+ {
return ValueComparer.equalValue(obj1, obj2);
}
@@ -479,7 +574,8 @@ public class MultiPropertyTest extends MultiMethodTest {
* The method just calls toString. This is a workaround to
* CodeWarrior's compiler bug.
*/
- private String callToString(Object obj) {
+ private String callToString(Object obj)
+ {
return toString(obj);
}
@@ -487,7 +583,8 @@ public class MultiPropertyTest extends MultiMethodTest {
* Gets string representation of the obj. In the implementation
* returns obj.toString().
*/
- protected String toString(Object obj) {
+ protected String toString(Object obj)
+ {
return obj == null ? "null" : obj.toString();
}
-} \ No newline at end of file
+}
diff --git a/qadevOOo/runner/lib/TestParameters.java b/qadevOOo/runner/lib/TestParameters.java
index 2176f46c3..8ab9a7a23 100644
--- a/qadevOOo/runner/lib/TestParameters.java
+++ b/qadevOOo/runner/lib/TestParameters.java
@@ -161,13 +161,13 @@ public class TestParameters extends Hashtable {
* This parameter contains the timeout used<br>
* by the watcher
*/
- public Integer TimeOut = new Integer(30000);
+ public Integer TimeOut = new Integer(3000000);
/*
* This parameter contains the timeout used<br>
* by the complex tests
*/
- public Integer ThreadTimeOut = new Integer(30000);
+ public Integer ThreadTimeOut = new Integer(3000000);
/*
* This parameter contains the time which the office could use to close for
diff --git a/qadevOOo/runner/org/openoffice/Runner.java b/qadevOOo/runner/org/openoffice/Runner.java
index 75a6d20a4..f716abfce 100644
--- a/qadevOOo/runner/org/openoffice/Runner.java
+++ b/qadevOOo/runner/org/openoffice/Runner.java
@@ -187,7 +187,7 @@ public class Runner
public static void main(String[] args)
{
- System.out.println("OOoRunner Main()");
+ System.out.println("OOoRunner Main() version from 20090825 (yyyymmdd)");
setStartTime(getTime());
diff --git a/qadevOOo/runner/util/DesktopTools.java b/qadevOOo/runner/util/DesktopTools.java
index 561536c06..3507a8a08 100644
--- a/qadevOOo/runner/util/DesktopTools.java
+++ b/qadevOOo/runner/util/DesktopTools.java
@@ -317,22 +317,22 @@ public class DesktopTools
}
catch (com.sun.star.util.CloseVetoException e)
{
- e.printStackTrace();
+ // e.printStackTrace();
System.out.println("Couldn't close document");
}
catch (com.sun.star.lang.DisposedException e)
{
- e.printStackTrace();
+ // e.printStackTrace();
System.out.println("Couldn't close document");
}
catch (java.lang.NullPointerException e)
{
- e.printStackTrace();
+ // e.printStackTrace();
System.out.println("Couldn't close document");
}
catch (com.sun.star.beans.PropertyVetoException e)
{
- e.printStackTrace();
+ // e.printStackTrace();
System.out.println("Couldn't close document");
}
}