@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()); }
@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()); }
public int getTextLimit() { checkWidget(); return text.getTextLimit(); }