Fixed crashing bug reported by Teresa Lam. Added tests so that I'm fairly

certain that no more crashing bugs exist.  Removed a marker for iffy code
after understanding that code via test cases.
This commit is contained in:
dchandler 2004-07-05 04:10:38 +00:00
parent 805124ebc0
commit 6cbea9f894
2 changed files with 20 additions and 1 deletions

View file

@ -93,6 +93,13 @@ public class DuffPaneTest extends TestCase {
ensureKeysGiveCorrectWylie(in, out); ensureKeysGiveCorrectWylie(in, out);
} }
private void noExceptions(String keys) {
dp.newDocument(); // initialize to a blank canvas.
fireKeysWithoutModifiers(keys);
// no assertion -- if an exception happens, then and only then
// the test fails.
}
private void ensureKeysGiveCorrectWylie(String keys, String wylie) { private void ensureKeysGiveCorrectWylie(String keys, String wylie) {
dp.newDocument(); // initialize to a blank canvas. dp.newDocument(); // initialize to a blank canvas.
fireKeysWithoutModifiers(keys); fireKeysWithoutModifiers(keys);
@ -803,6 +810,18 @@ public class DuffPaneTest extends TestCase {
*/ */
} }
public void testNoKeysCrashUs() {
/* why 130? because we want to try some extended ASCII
characters to make sure that they don't crash us either */
char max = (char)130;
for (char ch = 0; ch < max; ch++) {
noExceptions("" + ch);
for (char ch2 = 0; ch2 < max; ch2++) {
noExceptions("" + ch + ch2);
}
}
}
public void testDisambiguation() { public void testDisambiguation() {
ensureKeysGiveCorrectWylie("gya"); ensureKeysGiveCorrectWylie("gya");
ensureKeysGiveCorrectWylie("g.ya"); ensureKeysGiveCorrectWylie("g.ya");

View file

@ -212,7 +212,7 @@ public class TibetanMachineWeb implements THDLWylieConstants {
/** comma-delimited list of supported punctuation and /** comma-delimited list of supported punctuation and
miscellaneous characters: */ miscellaneous characters: */
private static final String others private static final String others
= "_, ,/,|,!,:,;,@,#,$,%,(,),H,M,&,@#,?,=,[,],{,},*,~X,X"; // FIXME: not yet supporting all these... = "_, ,/,|,!,:,;,@,#,$,%,(,),H,M,&,@#,?,=,{,},*,~X,X"; // FIXME: not yet supporting all these...
/** comma-delimited list of supported vowels: */ /** comma-delimited list of supported vowels: */
private static final String vowels private static final String vowels