changed println to logln.

X-SVN-Rev: 1214
This commit is contained in:
Alan Liu 2000-04-21 22:48:49 +00:00
parent f88555f6d8
commit 578dd7bcfa
6 changed files with 123 additions and 67 deletions

View file

@ -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();
}

View file

@ -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());
}
}

View file

@ -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.");
}
}

View file

@ -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.");
//}
}
}

View file

@ -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");
}
}

View file

@ -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();
}