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:
parent
805124ebc0
commit
6cbea9f894
2 changed files with 20 additions and 1 deletions
|
@ -93,6 +93,13 @@ public class DuffPaneTest extends TestCase {
|
|||
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) {
|
||||
dp.newDocument(); // initialize to a blank canvas.
|
||||
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() {
|
||||
ensureKeysGiveCorrectWylie("gya");
|
||||
ensureKeysGiveCorrectWylie("g.ya");
|
||||
|
|
|
@ -212,7 +212,7 @@ public class TibetanMachineWeb implements THDLWylieConstants {
|
|||
/** comma-delimited list of supported punctuation and
|
||||
miscellaneous characters: */
|
||||
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: */
|
||||
private static final String vowels
|
||||
|
|
Loading…
Reference in a new issue