Code example for TextView

Methods: addTextChangedListenerremoveTextChangedListener

0
  } 
 
  @Test 
  public void removeTextChangedListener_shouldRemoveTheListener() throws Exception { 
    MockTextWatcher watcher = new MockTextWatcher();
    textView.addTextChangedListener(watcher);
    assertTrue(shadowOf(textView).getWatchers().contains(watcher));
 
    textView.removeTextChangedListener(watcher);
    assertFalse(shadowOf(textView).getWatchers().contains(watcher));
  } 
 
  @Test 
  public void getPaint_returnsMeasureTextEnabledObject() throws Exception { 
    assertThat(textView.getPaint().measureText("12345")).isEqualTo(5f);
  } 
 
  @Test 
  public void append_whenSelectionIsAtTheEnd_shouldKeepSelectionAtTheEnd() throws Exception { 
    textView.setText("1", TextView.BufferType.EDITABLE);
    Selection.setSelection(textView.getEditableText(), 0, 0);