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

org.fest.assertions.api.android.graphics.drawable.BitmapDrawableAssert Maven / Gradle / Ivy

There is a newer version: 1.0.8
Show newest version
// Copyright 2013 Square, Inc.
package org.fest.assertions.api.android.graphics.drawable;

import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;

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

/** Assertions for {@link BitmapDrawable} instances. */
public class BitmapDrawableAssert
    extends AbstractDrawableAssert {
  public BitmapDrawableAssert(BitmapDrawable actual) {
    super(actual, BitmapDrawableAssert.class);
  }

  public BitmapDrawableAssert hasGravity(int gravity) {
    isNotNull();
    int actualGravity = actual.getGravity();
    assertThat(actualGravity) //
        .overridingErrorMessage("Expected gravity <%s> but was <%s>.", gravity, actualGravity) //
        .isEqualTo(gravity);
    return this;
  }

  public BitmapDrawableAssert hasTileModeX(Shader.TileMode mode) {
    isNotNull();
    Shader.TileMode actualMode = actual.getTileModeX();
    assertThat(actualMode) //
        .overridingErrorMessage("Expected X tile mode <%s> but was <%s>", mode, actualMode) //
        .isEqualTo(mode);
    return this;
  }

  public BitmapDrawableAssert hasTileModeY(Shader.TileMode mode) {
    isNotNull();
    Shader.TileMode actualMode = actual.getTileModeY();
    assertThat(actualMode) //
        .overridingErrorMessage("Expected Y tile mode <%s> but was <%s>", mode, actualMode) //
        .isEqualTo(mode);
    return this;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy