Code example for TextView

Methods: getTypefacesetTypeface

0
  } 
 
  @Test 
  public void canSetAndGetTypeface() throws Exception { 
    Typeface typeface = Robolectric.newInstanceOf(Typeface.class);
    textView.setTypeface(typeface);
    assertSame(typeface, textView.getTypeface());
  } 
 
  @Test 
  public void onTouchEvent_shouldCallMovementMethodOnTouchEventWithSetMotionEvent() throws Exception { 
    TestMovementMethod testMovementMethod = new TestMovementMethod();
    textView.setMovementMethod(testMovementMethod);
    textView.setLayoutParams(new ViewGroup.LayoutParams(100, 100));
    textView.measure(100, 100);
 
    MotionEvent event = MotionEvent.obtain(0, 0, 0, 0, 0, 0);
    textView.dispatchTouchEvent(event);
 
    assertEquals(testMovementMethod.event, event);
  }