예제 #1
0
 // test deletion
 @Test
 public void deleteTest1() {
   // if there's nothing and we do a deletion, nothing happens
   m.removeLastSignature();
   assertTrue(m.getTexts().isEmpty());
   assertEquals("", m.getCurrentSignature());
 }
예제 #2
0
 // test word entry
 @Test
 public void entryTest1() {
   m.updateSignature(2); // a
   m.insertWord();
   ArrayList<StringBuffer> expected = new ArrayList<StringBuffer>();
   expected.add(new StringBuffer("a"));
   ArrayList<StringBuffer> result = m.getTexts();
   for (int i = 0; i < expected.size(); i++) {
     assertEquals(expected.get(i).toString(), result.get(i).toString());
   }
 }
예제 #3
0
 @Test
 public void deleteTest3() {
   // if we do a deletion and there's no signature we are working on,
   // it should go back to the previously typed word
   m.updateSignature(2);
   m.updateSignature(3);
   m.insertWord();
   m.updateSignature(2);
   m.updateSignature(2);
   m.insertWord();
   m.removeLastSignature(); // this delete will go back to the previously
   // inserted word
   ArrayList<StringBuffer> expectedList = new ArrayList<StringBuffer>();
   expectedList.add(new StringBuffer("ad"));
   String expectedSig = "22";
   ArrayList<StringBuffer> resultList = m.getTexts();
   String resultSig = m.getCurrentSignature();
   for (int i = 0; i < expectedList.size(); i++) {
     assertEquals(expectedList.get(i).toString(), resultList.get(i).toString());
   }
   assertEquals(expectedSig, resultSig);
 }