Beispiel #1
0
 @Test
 public void testInitialValuesForSingleText() {
   assertEquals("", text.getText());
   assertEquals("", text.getMessage());
   assertEquals(Text.LIMIT, text.getTextLimit());
   assertEquals(0, text.getSelectionCount());
   assertEquals(new Point(0, 0), text.getSelection());
   assertEquals((char) 0, text.getEchoChar());
 }
Beispiel #2
0
 @Test
 public void testTextLimit() {
   text.setTextLimit(-1);
   assertEquals(-1, text.getTextLimit());
   text.setTextLimit(-20);
   assertEquals(-20, text.getTextLimit());
   text.setTextLimit(-12345);
   assertEquals(-12345, text.getTextLimit());
   text.setTextLimit(20);
   assertEquals(20, text.getTextLimit());
   try {
     text.setTextLimit(0);
     fail("Must not allow to set textLimit to zero");
   } catch (IllegalArgumentException e) {
     // as expected
   }
   text.setText("Sample_text");
   text.setTextLimit(6);
   assertEquals("Sample_text", text.getText());
   text.setText("Other_text");
   assertEquals("Other_", text.getText());
 }
Beispiel #3
0
 public int getTextLimit() {
   checkWidget();
   return text.getTextLimit();
 }