diff --git a/icu4j/src/com/ibm/richtext/test/TestTextPanel.java b/icu4j/src/com/ibm/richtext/test/TestTextPanel.java index 7118a2baf9a..b08bd7c4a49 100755 --- a/icu4j/src/com/ibm/richtext/test/TestTextPanel.java +++ b/icu4j/src/com/ibm/richtext/test/TestTextPanel.java @@ -1,5 +1,5 @@ /* - * @(#)$RCSfile: TestTextPanel.java,v $ $Revision: 1.2 $ $Date: 2000/04/21 22:11:24 $ + * @(#)$RCSfile: TestTextPanel.java,v $ $Revision: 1.3 $ $Date: 2000/04/21 22:48:49 $ * * (C) Copyright IBM Corp. 1998-1999. All Rights Reserved. * @@ -93,12 +93,23 @@ public final class TestTextPanel extends TestFmwk { } void assertNotExpectingEvents() { + assertNotExpectingEvents(false, 0, false); + } + + void assertNotExpectingEvents(int iterationCount, boolean exp) { + assertNotExpectingEvents(true, iterationCount, exp); + } + + private void assertNotExpectingEvents(boolean logDetails, int iterationCount, boolean exp) { boolean e = false; for (int i=0; i < status.length; i++) { if (status[i] == DEFINITELY) { - System.out.println("Expecting event " + - (i+TextPanelEvent.TEXT_PANEL_FIRST)); + if (logDetails) { + logln("Expecting event " + + (i+TextPanelEvent.TEXT_PANEL_FIRST)); + logln("iterationCount="+iterationCount+"; expexting="+exp); + } e = true; } } @@ -212,6 +223,12 @@ public final class TestTextPanel extends TestFmwk { super.errln(message); } + // For inner class accessibility + protected void logln(String message) { + + super.logln(message); + } + public TestTextPanel(MTextPanel panel) { this(); @@ -468,18 +485,18 @@ public final class TestTextPanel extends TestFmwk { fListener.expectEvent(TextPanelEvent.UNDO_STATE_CHANGED); exp = true; } - try { + //try { fTextPanel.setCommandLogSize(BIG_COMMAND_LOG_SIZE); if (fTextPanel.canRedo()) { errln("canRedo after setCommandLogSize"); } - fListener.assertNotExpectingEvents(); - } - catch(Error e) { - System.out.println("iterationCount="+iterationCount+"; expexting="+exp); - throw e; - } + fListener.assertNotExpectingEvents(iterationCount, exp); + //} + //catch(Error e) { + // logln("iterationCount="+iterationCount+"; expexting="+exp); + // throw e; + //} MConstText insText = new StyledText("7", AttributeMap.EMPTY_ATTRIBUTE_MAP); @@ -817,13 +834,13 @@ public final class TestTextPanel extends TestFmwk { fListener.expectEvent(TextPanelEvent.SELECTION_RANGE_CHANGED); } forwarder.handleKeyEvent(event); - try { - fListener.assertNotExpectingEvents(); - } - catch(Error e) { - System.out.println("i="+i+"; typedChar="+Integer.toHexString(typedChar)); - throw e; - } + //try { + fListener.assertNotExpectingEvents(i, false); + //} + //catch(Error e) { + // logln("i="+i+"; typedChar="+Integer.toHexString(typedChar)); + // throw e; + //} } fListener.allowAll(); } diff --git a/icu4j/src/com/ibm/richtext/tests/TestAll.java b/icu4j/src/com/ibm/richtext/tests/TestAll.java index 7cff68c8344..01cdc8ef97d 100755 --- a/icu4j/src/com/ibm/richtext/tests/TestAll.java +++ b/icu4j/src/com/ibm/richtext/tests/TestAll.java @@ -1,5 +1,5 @@ /* - * @(#)$RCSfile: TestAll.java,v $ $Revision: 1.1 $ $Date: 2000/04/20 17:46:57 $ + * @(#)$RCSfile: TestAll.java,v $ $Revision: 1.2 $ $Date: 2000/04/21 22:48:49 $ * * (C) Copyright IBM Corp. 1998-1999. All Rights Reserved. * @@ -14,20 +14,42 @@ */ package com.ibm.richtext.tests; -public class TestAll { +import com.ibm.test.TestFmwk; + +public class TestAll extends TestFmwk { static final String COPYRIGHT = "(C) Copyright IBM Corp. 1998-1999 - All Rights Reserved"; - public static void main(String[] args) { - - TestAttributeSet.main(args); - TestAttributeMap.main(args); - TestFormatter.main(args); - TestMText.main(args); - TestMTextStreaming.main(args); - TestParagraphStyles.main(args); - TestTextPanel.main(args); - System.out.println("TestAll: DONE"); + public static void main(String[] args) throws Exception { + new TestAll().run(args); + } + + public void TestAttributeSet() throws Exception { + run(new TestAttributeSet()); + } + + public void TestAttributeMap() throws Exception { + run(new TestAttributeMap()); + } + + public void TestFormatter() throws Exception { + run(new TestFormatter()); + } + + public void TestMText() throws Exception { + run(new TestMText()); + } + + public void TestParagraphStyles() throws Exception { + run(new TestParagraphStyles()); + } + + public void TestMTextStreaming() throws Exception { + run(new TestMTextStreaming()); + } + + public void TestTextPanel() throws Exception { + run(new TestTextPanel()); } } \ No newline at end of file diff --git a/icu4j/src/com/ibm/richtext/tests/TestAttributeMap.java b/icu4j/src/com/ibm/richtext/tests/TestAttributeMap.java index bfbe326793d..f420876e6ac 100755 --- a/icu4j/src/com/ibm/richtext/tests/TestAttributeMap.java +++ b/icu4j/src/com/ibm/richtext/tests/TestAttributeMap.java @@ -1,5 +1,5 @@ /* - * @(#)$RCSfile: TestAttributeMap.java,v $ $Revision: 1.2 $ $Date: 2000/04/21 22:11:24 $ + * @(#)$RCSfile: TestAttributeMap.java,v $ $Revision: 1.3 $ $Date: 2000/04/21 22:48:49 $ * * (C) Copyright IBM Corp. 1998-1999. All Rights Reserved. * @@ -256,12 +256,12 @@ public class TestAttributeMap extends TestFmwk { if (!equalMaps(lhs, rhs)) { map.intersectWith(intersect); - System.out.println("intersect: " + intersect); - System.out.println("keySet: " + keySet); - System.out.println("removeSet: " + removeSet); - System.out.println("map: " + map); - System.out.println("lhs: " + lhs); - System.out.println("rhs: " + rhs); + logln("intersect: " + intersect); + logln("keySet: " + keySet); + logln("removeSet: " + removeSet); + logln("map: " + map); + logln("lhs: " + lhs); + logln("rhs: " + rhs); errln("Maps are not equal."); } } diff --git a/icu4j/src/com/ibm/richtext/tests/TestMText.java b/icu4j/src/com/ibm/richtext/tests/TestMText.java index 67a8b7757fd..f0d320f6399 100755 --- a/icu4j/src/com/ibm/richtext/tests/TestMText.java +++ b/icu4j/src/com/ibm/richtext/tests/TestMText.java @@ -1,5 +1,5 @@ /* - * @(#)$RCSfile: TestMText.java,v $ $Revision: 1.2 $ $Date: 2000/04/21 22:11:24 $ + * @(#)$RCSfile: TestMText.java,v $ $Revision: 1.3 $ $Date: 2000/04/21 22:48:49 $ * * (C) Copyright IBM Corp. 1998-1999. All Rights Reserved. * @@ -341,10 +341,10 @@ public class TestMText extends TestFmwk { } if (damageStart != text.damagedRangeStart() || damageLimit != text.damagedRangeLimit()) { - System.out.println("Test iteration: " + testIteration); - System.out.println("startingAt: " + startingAt + "; endingAt: " + endingAt); - System.out.println("damageStart: " + damageStart + "; damageLimit: " + damageLimit); - System.out.println("text.rangeStart: " + text.damagedRangeStart() + + logln("Test iteration: " + testIteration); + logln("startingAt: " + startingAt + "; endingAt: " + endingAt); + logln("damageStart: " + damageStart + "; damageLimit: " + damageLimit); + logln("text.rangeStart: " + text.damagedRangeStart() + "text.rangeLimit: " + text.damagedRangeLimit()); errln("Damage range start or limit is not expected value"); } @@ -425,7 +425,7 @@ public class TestMText extends TestFmwk { casesExecuted[theCase] = true; if (testIteration == stopAt) { - System.out.println("Stop here!"); + testIteration = stopAt; // Convenient place to put breakpoint } int timeStamp = buf.getTimeStamp(); @@ -618,8 +618,8 @@ public class TestMText extends TestFmwk { if (oldPlainText != null) { if ((timeStamp==buf.getTimeStamp()) != oldPlainText.equals(plainText)) { - System.out.println("plainText hashCode: " + plainText.hashCode()); - System.out.println("oldPlainText hashCode: " + oldPlainText.hashCode()); + logln("plainText hashCode: " + plainText.hashCode()); + logln("oldPlainText hashCode: " + oldPlainText.hashCode()); errln("Time stamp is incorrect"); } } @@ -715,7 +715,7 @@ public class TestMText extends TestFmwk { } } //if (allCasesExecuted) { - // System.out.println("All cases executed."); + // logln("All cases executed."); //} } } \ No newline at end of file diff --git a/icu4j/src/com/ibm/richtext/tests/TestParagraphStyles.java b/icu4j/src/com/ibm/richtext/tests/TestParagraphStyles.java index eb542ea68f6..3d3a1924455 100755 --- a/icu4j/src/com/ibm/richtext/tests/TestParagraphStyles.java +++ b/icu4j/src/com/ibm/richtext/tests/TestParagraphStyles.java @@ -1,5 +1,5 @@ /* - * @(#)$RCSfile: TestParagraphStyles.java,v $ $Revision: 1.2 $ $Date: 2000/04/21 22:11:24 $ + * @(#)$RCSfile: TestParagraphStyles.java,v $ $Revision: 1.3 $ $Date: 2000/04/21 22:48:49 $ * * (C) Copyright IBM Corp. 1998-1999. All Rights Reserved. * @@ -195,7 +195,7 @@ public final class TestParagraphStyles extends TestFmwk { } finally { if (i < NUM_TESTS) { - System.out.println("i=" + i); + logln("iteration=" + i); } } } @@ -236,7 +236,7 @@ public final class TestParagraphStyles extends TestFmwk { Integer.MIN_VALUE : start + (srcLimit-srcStart); if (target.damagedRangeLimit() != damageLimit) { - System.out.println("limit: " + damageLimit + "; target.limit: " + + logln("limit: " + damageLimit + "; target.limit: " + target.damagedRangeLimit()); errln("Damaged range limit is incorrect"); } @@ -244,7 +244,7 @@ public final class TestParagraphStyles extends TestFmwk { final int damageStart = (damageLimit==Integer.MIN_VALUE)? Integer.MAX_VALUE : (stylePropogated? target.paragraphStart(Math.max(0, start-1)) : start); if (target.damagedRangeStart() > damageStart) { - System.out.println("start: " + damageStart + "; target.start: " + + logln("start: " + damageStart + "; target.start: " + target.damagedRangeStart()); errln("Damaged range start is incorrect"); } @@ -314,7 +314,7 @@ public final class TestParagraphStyles extends TestFmwk { } if (sepCount + 1 != pCount) { - System.out.println("sepCount=" + sepCount + "; pCount=" + pCount); + logln("sepCount=" + sepCount + "; pCount=" + pCount); errln("Paragraph count is not consistent with characters"); } } diff --git a/icu4j/src/com/ibm/richtext/tests/TestTextPanel.java b/icu4j/src/com/ibm/richtext/tests/TestTextPanel.java index 7118a2baf9a..b08bd7c4a49 100755 --- a/icu4j/src/com/ibm/richtext/tests/TestTextPanel.java +++ b/icu4j/src/com/ibm/richtext/tests/TestTextPanel.java @@ -1,5 +1,5 @@ /* - * @(#)$RCSfile: TestTextPanel.java,v $ $Revision: 1.2 $ $Date: 2000/04/21 22:11:24 $ + * @(#)$RCSfile: TestTextPanel.java,v $ $Revision: 1.3 $ $Date: 2000/04/21 22:48:49 $ * * (C) Copyright IBM Corp. 1998-1999. All Rights Reserved. * @@ -93,12 +93,23 @@ public final class TestTextPanel extends TestFmwk { } void assertNotExpectingEvents() { + assertNotExpectingEvents(false, 0, false); + } + + void assertNotExpectingEvents(int iterationCount, boolean exp) { + assertNotExpectingEvents(true, iterationCount, exp); + } + + private void assertNotExpectingEvents(boolean logDetails, int iterationCount, boolean exp) { boolean e = false; for (int i=0; i < status.length; i++) { if (status[i] == DEFINITELY) { - System.out.println("Expecting event " + - (i+TextPanelEvent.TEXT_PANEL_FIRST)); + if (logDetails) { + logln("Expecting event " + + (i+TextPanelEvent.TEXT_PANEL_FIRST)); + logln("iterationCount="+iterationCount+"; expexting="+exp); + } e = true; } } @@ -212,6 +223,12 @@ public final class TestTextPanel extends TestFmwk { super.errln(message); } + // For inner class accessibility + protected void logln(String message) { + + super.logln(message); + } + public TestTextPanel(MTextPanel panel) { this(); @@ -468,18 +485,18 @@ public final class TestTextPanel extends TestFmwk { fListener.expectEvent(TextPanelEvent.UNDO_STATE_CHANGED); exp = true; } - try { + //try { fTextPanel.setCommandLogSize(BIG_COMMAND_LOG_SIZE); if (fTextPanel.canRedo()) { errln("canRedo after setCommandLogSize"); } - fListener.assertNotExpectingEvents(); - } - catch(Error e) { - System.out.println("iterationCount="+iterationCount+"; expexting="+exp); - throw e; - } + fListener.assertNotExpectingEvents(iterationCount, exp); + //} + //catch(Error e) { + // logln("iterationCount="+iterationCount+"; expexting="+exp); + // throw e; + //} MConstText insText = new StyledText("7", AttributeMap.EMPTY_ATTRIBUTE_MAP); @@ -817,13 +834,13 @@ public final class TestTextPanel extends TestFmwk { fListener.expectEvent(TextPanelEvent.SELECTION_RANGE_CHANGED); } forwarder.handleKeyEvent(event); - try { - fListener.assertNotExpectingEvents(); - } - catch(Error e) { - System.out.println("i="+i+"; typedChar="+Integer.toHexString(typedChar)); - throw e; - } + //try { + fListener.assertNotExpectingEvents(i, false); + //} + //catch(Error e) { + // logln("i="+i+"; typedChar="+Integer.toHexString(typedChar)); + // throw e; + //} } fListener.allowAll(); }