All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.fest.assertions.api.android.widget.AbstractFrameLayoutAssert Maven / Gradle / Ivy

There is a newer version: 1.0.8
Show newest version
package org.fest.assertions.api.android.widget;

import android.graphics.drawable.Drawable;
import android.widget.FrameLayout;
import org.fest.assertions.api.android.view.AbstractViewGroupAssert;

import static org.fest.assertions.api.Assertions.assertThat;

public abstract class AbstractFrameLayoutAssert, A extends FrameLayout>
    extends AbstractViewGroupAssert {
  protected AbstractFrameLayoutAssert(A actual, Class selfType) {
    super(actual, selfType);
  }

  public S hasForeground(Drawable drawable) {
    isNotNull();
    Drawable actualDrawable = actual.getForeground();
    assertThat(actualDrawable) //
        .overridingErrorMessage("Expected foreground drawable <%s> but was <%s>", drawable,
            actualDrawable) //
        .isSameAs(drawable);
    return myself;
  }

  public S hasForegroundGravity(int gravity) {
    isNotNull();
    int actualGravity = actual.getForegroundGravity();
    assertThat(actualGravity) //
        .overridingErrorMessage("Expected foreground gravity <%s> but was <%s>.", gravity,
            actualGravity) //
        .isEqualTo(gravity);
    return myself;
  }

  public S isMeasuringAllChildren() {
    isNotNull();
    assertThat(actual.getMeasureAllChildren()) //
        .overridingErrorMessage("Expected to be measuring all children but was not.") //
        .isTrue();
    return myself;
  }

  public S isNotMeasuringAllChildren() {
    isNotNull();
    assertThat(actual.getMeasureAllChildren()) //
        .overridingErrorMessage("Expected to not be measuring all children but was.") //
        .isFalse();
    return myself;
  }

  public S isDelayingChildPressedState() {
    isNotNull();
    assertThat(actual.shouldDelayChildPressedState()) //
        .overridingErrorMessage("Epxected to be delaying child pressed state but was not.") //
        .isTrue();
    return myself;
  }

  public S isNotDelayingChildPressedState() {
    isNotNull();
    assertThat(actual.shouldDelayChildPressedState()) //
        .overridingErrorMessage("Expected to not be delaying child pressed state but was.") //
        .isFalse();
    return myself;
  }
}