deweese 2003/07/03 07:10:06
Modified: sources/org/apache/batik/bridge SVGTextElementBridge.java
test-resources/org/apache/batik/test samplesRendering.xml
unitTesting.xml
test-resources/org/apache/batik/test/resources
Messages.properties
Added: test-sources/org/apache/batik/test MemoryLeakTest.java
MemoryLeakTestValidator.java
Log:
1) Fixed a bug in bidi-override, bidi-embed handling.
2) New Test baseclass (and validator) for Memory Leak detection.
Revision Changes Path
1.82 +4 -1
xml-batik/sources/org/apache/batik/bridge/SVGTextElementBridge.java
Index: SVGTextElementBridge.java
===================================================================
RCS file:
/home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGTextElementBridge.java,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -r1.81 -r1.82
--- SVGTextElementBridge.java 11 Jun 2003 22:07:25 -0000 1.81
+++ SVGTextElementBridge.java 3 Jul 2003 14:10:01 -0000 1.82
@@ -1423,11 +1423,13 @@
TextAttribute.RUN_DIRECTION_LTR);
if ((cbidi & 0x1) == 1) cbidi++; // was odd now even
else cbidi+=2; // next greater even number
+ break;
case 'r':
result.put(TextAttribute.RUN_DIRECTION,
TextAttribute.RUN_DIRECTION_RTL);
if ((cbidi & 0x1) == 1) cbidi+=2; // next greater odd number
else cbidi++; // was even now odd
+ break;
}
switch (s.charAt(0)) {
@@ -1435,6 +1437,7 @@
cbidi = -cbidi; // For bidi-override we want a negative number.
break;
}
+
result.put(TextAttribute.BIDI_EMBEDDING, new Integer(cbidi));
}
1.100 +1 -2
xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml
Index: samplesRendering.xml
===================================================================
RCS file:
/home/cvs/xml-batik/test-resources/org/apache/batik/test/samplesRendering.xml,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -r1.99 -r1.100
--- samplesRendering.xml 3 Jul 2003 02:00:00 -0000 1.99
+++ samplesRendering.xml 3 Jul 2003 14:10:03 -0000 1.100
@@ -386,5 +386,4 @@
<test id="samples/tests/spec/scripting/rootSizeChange.svg" />
<test id="samples/tests/spec/scripting/rectResizeOnClick.svg" />
</testGroup>
-
</testSuite>
1.7 +45 -31 xml-batik/test-resources/org/apache/batik/test/unitTesting.xml
Index: unitTesting.xml
===================================================================
RCS file: /home/cvs/xml-batik/test-resources/org/apache/batik/test/unitTesting.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- unitTesting.xml 11 Apr 2002 08:07:24 -0000 1.6
+++ unitTesting.xml 3 Jul 2003 14:10:04 -0000 1.7
@@ -1,34 +1,48 @@
-<!-- ========================================================================= -->
-<!-- Copyright (C) The Apache Software Foundation. All rights reserved. -->
-<!-- -->
-<!-- This software is published under the terms of the Apache Software License -->
-<!-- version 1.1, a copy of which has been included with this distribution in -->
-<!-- the LICENSE file. -->
-<!-- ========================================================================= -->
+<!-- ===================================================================== -->
+<!-- Copyright (C) The Apache Software Foundation. All rights reserved. -->
+<!-- -->
+<!-- This software is published under the terms of the Apache Software -->
+<!-- License version 1.1, a copy of which has been included with this -->
+<!-- distribution in the LICENSE file. -->
+<!-- ===================================================================== -->
-<!-- ========================================================================= -->
-<!-- @author [EMAIL PROTECTED] -->
+<!-- ===================================================================== -->
+<!-- @author [EMAIL PROTECTED] -->
<!-- @version $Id$ -->
-<!-- ========================================================================= -->
+<!-- ===================================================================== -->
<testSuite id="test.unitTesting" name="Test Module - Unit Testing">
- <!-- ==========================================================================
-->
- <!-- Validates that the XMLTestSuiteRunner class is operating as expected
-->
- <!-- ==========================================================================
-->
- <test id="xmlTestSuiteRunnerValidator"
class="org.apache.batik.test.xml.XMLTestSuiteRunnerValidator" />
-
- <!-- ==========================================================================
-->
- <!-- Validates that the SVGRenderingAccuracyTest class is operating as expected
-->
- <!-- ==========================================================================
-->
- <test id="svgRenderingAccuracyTestValidator"
class="org.apache.batik.test.svg.SVGRenderingAccuracyTestValidator" />
-
- <!--
============================================================================ -->
- <!-- Validates that the SelfContainedSVGOnLoadTest class is operating as
expected -->
- <!--
============================================================================ -->
- <test id="selfContainedSVGOnLoadTestValidator"
class="org.apache.batik.test.svg.SelfContainedSVGOnLoadTestValidator" />
-
- <!-- ==========================================================================
-->
- <!-- Validates that the SVGAccuracyTest class is operating as expected
-->
- <!-- ==========================================================================
-->
- <test id="svgAccuracyTestValidator"
class="org.apache.batik.svggen.SVGAccuracyTestValidator" />
+ <!-- ================================================================= -->
+ <!-- Validates that the XMLTestSuiteRunner class is operating -->
+ <!-- as expected -->
+ <!-- ================================================================= -->
+ <test id="xmlTestSuiteRunnerValidator"
+ class="org.apache.batik.test.xml.XMLTestSuiteRunnerValidator" />
+
+ <!-- ================================================================= -->
+ <!-- Validates that the SVGRenderingAccuracyTest class is operating as -->
+ <!-- expected -->
+ <!-- ================================================================= -->
+ <test id="svgRenderingAccuracyTestValidator"
+ class="org.apache.batik.test.svg.SVGRenderingAccuracyTestValidator"/>
+
+ <!-- ================================================================== -->
+ <!-- Validates that the SelfContainedSVGOnLoadTest class is operating -->
+ <!-- as expected -->
+ <!-- ================================================================== -->
+ <test id="selfContainedSVGOnLoadTestValidator"
+ class="org.apache.batik.test.svg.SelfContainedSVGOnLoadTestValidator" />
+
+ <!-- ================================================================== -->
+ <!-- Validates that the SVGAccuracyTest class is operating as expected -->
+ <!-- ================================================================== -->
+ <test id="svgAccuracyTestValidator"
+ class="org.apache.batik.svggen.SVGAccuracyTestValidator" />
+
+
+ <!-- ================================================================== -->
+ <!-- Validates that the Memory Leak Test is operating as expected -->
+ <!-- ================================================================== -->
+ <test id="memoryLeakTestValidator"
+ class="org.apache.batik.test.MemoryLeakTestValidator" />
</testSuite>
1.6 +2 -2
xml-batik/test-resources/org/apache/batik/test/resources/Messages.properties
Index: Messages.properties
===================================================================
RCS file:
/home/cvs/xml-batik/test-resources/org/apache/batik/test/resources/Messages.properties,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Messages.properties 8 Oct 2001 14:15:04 -0000 1.5
+++ Messages.properties 3 Jul 2003 14:10:05 -0000 1.6
@@ -143,5 +143,5 @@
TestReportMailer.messages.email.report.subject = \
Test Report for : {0}
-
-
+MemoryLeakTest.message.error.objs.not.cleared = \
+Not all registered objects cleared: {0}
1.1 xml-batik/test-sources/org/apache/batik/test/MemoryLeakTest.java
Index: MemoryLeakTest.java
===================================================================
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
* ------------------------------------------------------------------------- *
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
*****************************************************************************/
package org.apache.batik.test;
import java.util.Set;
import java.util.HashSet;
import java.util.Iterator;
import org.apache.batik.test.AbstractTest;
import org.apache.batik.test.DefaultTestReport;
import org.apache.batik.test.TestReport;
import org.apache.batik.util.CleanerThread;
/**
* One line Class Desc
*
* Complete Class Desc
*
* @author <a href="mailto:[EMAIL PROTECTED]>l449433</a>
* @version $Id: MemoryLeakTest.java,v 1.1 2003/07/03 14:10:05 deweese Exp $
*/
public abstract class MemoryLeakTest extends AbstractTest {
final static int NUM_GC=12;
final static String ERROR_OBJS_NOT_CLEARED =
"MemoryLeakTest.message.error.objs.not.cleared";
final static String ERROR_DESCRIPTION =
"TestReport.entry.key.error.description";
public static String fmt(String key, Object []args) {
return Messages.formatMessage(key, args);
}
public MemoryLeakTest() {
}
Set objs = new HashSet();
public void registerObject(Object o) {
synchronized (objs) {
objs.add(new WeakRef(o));
}
}
public void registerObjectDesc(Object o, String desc) {
synchronized (objs) {
objs.add(new WeakRef(o, desc));
}
}
public TestReport runImpl() throws Exception {
TestReport ret = doSomething();
if ((ret != null) && !ret.hasPassed())
return ret;
for (int i=0; i<NUM_GC; i++)
System.gc();
StringBuffer sb = new StringBuffer();
int count = 0;
synchronized (objs) {
Iterator i = objs.iterator();
while (i.hasNext()) {
WeakRef wr = (WeakRef)i.next();
Object o = wr.get();
if (o == null) continue;
if (count != 0)
sb.append(",\n");
sb.append(wr.getDesc());
count++;
}
}
DefaultTestReport report = new DefaultTestReport(this);
if (count == 0) {
report.setPassed(true);
return report;
}
report.setErrorCode(ERROR_OBJS_NOT_CLEARED);
report.setDescription(new TestReport.Entry[] {
new TestReport.Entry
(fmt(ERROR_DESCRIPTION, null),
fmt(ERROR_OBJS_NOT_CLEARED, new Object[]{sb.toString()}))
});
report.setPassed(false);
return report;
}
public abstract TestReport doSomething() throws Exception;
public class WeakRef extends CleanerThread.WeakReferenceCleared {
String desc;
public WeakRef(Object o) {
super(o);
this.desc = o.toString();
}
public WeakRef(Object o, String desc) {
super(o);
this.desc = desc;
}
public String getDesc() { return desc; }
public void cleared() {
synchronized (objs) {
objs.remove(this);
}
}
}
};
1.1
xml-batik/test-sources/org/apache/batik/test/MemoryLeakTestValidator.java
Index: MemoryLeakTestValidator.java
===================================================================
/*****************************************************************************
* Copyright (C) The Apache Software Foundation. All rights reserved. *
* ------------------------------------------------------------------------- *
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
*****************************************************************************/
package org.apache.batik.test;
import org.apache.batik.test.TestReport;
/**
* One line Class Desc
*
* Complete Class Desc
*
* @author <a href="mailto:[EMAIL PROTECTED]>l449433</a>
* @version $Id: MemoryLeakTestValidator.java,v 1.1 2003/07/03 14:10:05 deweese Exp $
*/
public class MemoryLeakTestValidator extends MemoryLeakTest {
public MemoryLeakTestValidator() {
}
Link start;
public TestReport doSomething() throws Exception {
for (int i=0; i<20; i++)
registerObjectDesc(new Object(), "Obj#"+i);
for (int i=0; i<10; i++) {
Pair p1 = new Pair();
Pair p2 = new Pair();
p1.mate(p2);
registerObjectDesc(p2, "Pair#"+i);
}
Link p = null;
for (int i=0; i<10; i++) {
p = new Link(p);
registerObjectDesc(p, "Link#"+i);
}
// Uncomment this to make the test fail with all the links.
// start = p;
return null;
}
public static class Pair {
Pair myMate;
public Pair() { };
public void mate(Pair p) {
this.myMate = p;
p.myMate = this;
}
}
public static class Link {
public Link prev;
public Link(Link prev) {
this.prev = prev;
}
}
};
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]