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

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

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

import android.widget.HorizontalScrollView;

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

/** Assertions for {@link HorizontalScrollView} instances. */
public class HorizontalScrollViewAssert
    extends AbstractFrameLayoutAssert {
  public HorizontalScrollViewAssert(HorizontalScrollView actual) {
    super(actual, HorizontalScrollViewAssert.class);
  }

  public HorizontalScrollViewAssert hasMaximumScrollAmount(int amount) {
    isNotNull();
    int actualAmount = actual.getMaxScrollAmount();
    assertThat(actualAmount) //
        .overridingErrorMessage("Expected maximum scroll amount <%s> but was <%s>.", amount,
            actualAmount) //
        .isEqualTo(amount);
    return this;
  }

  public HorizontalScrollViewAssert isFillingViewport() {
    isNotNull();
    assertThat(actual.isFillViewport()) //
        .overridingErrorMessage("Expected to be filling viewport but was not.") //
        .isTrue();
    return this;
  }

  public HorizontalScrollViewAssert isNotFillingViewport() {
    isNotNull();
    assertThat(actual.isFillViewport()) //
        .overridingErrorMessage("Expected to not be filling viewport but was.") //
        .isFalse();
    return this;
  }

  public HorizontalScrollViewAssert isSmoothScrollingEnabled() {
    isNotNull();
    assertThat(actual.isSmoothScrollingEnabled()) //
        .overridingErrorMessage("Expected smooth scrolling to be enabled but was disabled.") //
        .isTrue();
    return this;
  }

  public HorizontalScrollViewAssert isSmoothScrollingDisabled() {
    isNotNull();
    assertThat(actual.isSmoothScrollingEnabled()) //
        .overridingErrorMessage("Expected smooth scrolling to be disabled but was enabled.") //
        .isFalse();
    return this;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy