@Override
  public void onDraw(Canvas canvas) {
    final boolean keyboardChanged = mKeyboardChanged;
    super.onDraw(canvas);
    // switching animation
    if (mAnimationLevel != AnimationsLevel.None && keyboardChanged && (mInAnimation != null)) {
      startAnimation(mInAnimation);
      mInAnimation = null;
    }

    if (mGestureTypingPathShouldBeDrawn) {
      mGestureDrawingHelper.draw(canvas);
    }

    // showing any requested watermark
    float watermarkX = mWatermarkEdgeX;
    final float watermarkY = getHeight() - mWatermarkDimen - mWatermarkMargin;
    for (Drawable watermark : mWatermarks) {
      watermarkX -= (mWatermarkDimen + mWatermarkMargin);
      canvas.translate(watermarkX, watermarkY);
      watermark.draw(canvas);
      canvas.translate(-watermarkX, -watermarkY);
    }
  }
@Test
  public void testExtraDrawMultiple() {
    ExtraDraw mockDraw1 = Mockito.mock(ExtraDraw.class);
    ExtraDraw mockDraw2 = Mockito.mock(ExtraDraw.class);
    Mockito.doReturn(true).when(mockDraw1).onDraw(any(), any(), same(mViewUnderTest));
    Mockito.doReturn(true).when(mockDraw2).onDraw(any(), any(), same(mViewUnderTest));

    Robolectric.getForegroundThreadScheduler().pause();
    Assert.assertFalse(Robolectric.getForegroundThreadScheduler().areAnyRunnable());
    mViewUnderTest.addExtraDraw(mockDraw1);
    mViewUnderTest.addExtraDraw(mockDraw2);

    Mockito.verify(mockDraw1, Mockito.never()).onDraw(any(), any(), same(mViewUnderTest));
    Mockito.verify(mockDraw2, Mockito.never()).onDraw(any(), any(), same(mViewUnderTest));

    Assert.assertTrue(Robolectric.getForegroundThreadScheduler().size() > 0);
    Robolectric.getForegroundThreadScheduler().advanceToLastPostedRunnable();
    mViewUnderTest.onDraw(Mockito.mock(Canvas.class));

    Mockito.verify(mockDraw1, Mockito.times(1)).onDraw(any(), any(), same(mViewUnderTest));
    Mockito.verify(mockDraw2, Mockito.times(1)).onDraw(any(), any(), same(mViewUnderTest));

    Assert.assertTrue(Robolectric.getForegroundThreadScheduler().size() > 0);
    Robolectric.getForegroundThreadScheduler().advanceToLastPostedRunnable();
    mViewUnderTest.onDraw(Mockito.mock(Canvas.class));

    Mockito.verify(mockDraw1, Mockito.times(2)).onDraw(any(), any(), same(mViewUnderTest));
    Mockito.verify(mockDraw2, Mockito.times(2)).onDraw(any(), any(), same(mViewUnderTest));

    Assert.assertTrue(Robolectric.getForegroundThreadScheduler().size() > 0);

    Mockito.doReturn(false).when(mockDraw1).onDraw(any(), any(), same(mViewUnderTest));

    Robolectric.getForegroundThreadScheduler().advanceToLastPostedRunnable();
    mViewUnderTest.onDraw(Mockito.mock(Canvas.class));

    Mockito.verify(mockDraw1, Mockito.times(3)).onDraw(any(), any(), same(mViewUnderTest));
    Mockito.verify(mockDraw2, Mockito.times(3)).onDraw(any(), any(), same(mViewUnderTest));

    Assert.assertTrue(Robolectric.getForegroundThreadScheduler().size() > 0);

    Robolectric.getForegroundThreadScheduler().advanceToLastPostedRunnable();
    mViewUnderTest.onDraw(Mockito.mock(Canvas.class));

    Mockito.verify(mockDraw1, Mockito.times(3)).onDraw(any(), any(), same(mViewUnderTest));
    Mockito.verify(mockDraw2, Mockito.times(4)).onDraw(any(), any(), same(mViewUnderTest));

    Assert.assertTrue(Robolectric.getForegroundThreadScheduler().size() > 0);

    Robolectric.getForegroundThreadScheduler().advanceToLastPostedRunnable();
    mViewUnderTest.onDraw(Mockito.mock(Canvas.class));

    Mockito.verify(mockDraw1, Mockito.times(3)).onDraw(any(), any(), same(mViewUnderTest));
    Mockito.verify(mockDraw2, Mockito.times(5)).onDraw(any(), any(), same(mViewUnderTest));

    Assert.assertTrue(Robolectric.getForegroundThreadScheduler().size() > 0);

    Mockito.doReturn(false).when(mockDraw2).onDraw(any(), any(), same(mViewUnderTest));

    Robolectric.getForegroundThreadScheduler().advanceToLastPostedRunnable();
    mViewUnderTest.onDraw(Mockito.mock(Canvas.class));

    Mockito.verify(mockDraw1, Mockito.times(3)).onDraw(any(), any(), same(mViewUnderTest));
    Mockito.verify(mockDraw2, Mockito.times(6)).onDraw(any(), any(), same(mViewUnderTest));

    Assert.assertFalse(Robolectric.getForegroundThreadScheduler().size() > 0);

    // adding another one
    ExtraDraw mockDraw3 = Mockito.mock(ExtraDraw.class);
    mViewUnderTest.addExtraDraw(mockDraw3);
    Assert.assertTrue(Robolectric.getForegroundThreadScheduler().size() > 0);
    Robolectric.getForegroundThreadScheduler().advanceToLastPostedRunnable();
    mViewUnderTest.onDraw(Mockito.mock(Canvas.class));

    Mockito.verify(mockDraw1, Mockito.times(3)).onDraw(any(), any(), same(mViewUnderTest));
    Mockito.verify(mockDraw2, Mockito.times(6)).onDraw(any(), any(), same(mViewUnderTest));
    Mockito.verify(mockDraw3, Mockito.times(1)).onDraw(any(), any(), same(mViewUnderTest));

    Assert.assertFalse(Robolectric.getForegroundThreadScheduler().size() > 0);
  }