Search in sources :

Example 1 with TestAdapterBuilder

use of com.tonicartos.superslim.util.TestAdapterBuilder in project SuperSLiM by TonicArtos.

the class GridLayoutTests method test_overscrollBeforeStartBeforeEnd.

@Test
public void test_overscrollBeforeStartBeforeEnd() throws Exception {
    final int numItems = 1;
    final int dy = 100;
    RecyclerView.Adapter adapter;
    int[] layoutPadding;
    adapter = new TestAdapterBuilder().addGridSection(numItems, Utils.RV_WIDTH, Utils.RV_HEIGHT, null).build(mActivity);
    layoutPadding = new int[] { 0, 0, 0, 0 };
    Utils.doOverscrollTest(new int[] { 0, -dy }, layoutPadding, true, adapter, mLayoutManager, mRecyclerView);
}
Also used : TestAdapterBuilder(com.tonicartos.superslim.util.TestAdapterBuilder) RecyclerView(android.support.v7.widget.RecyclerView) Test(org.junit.Test)

Example 2 with TestAdapterBuilder

use of com.tonicartos.superslim.util.TestAdapterBuilder in project SuperSLiM by TonicArtos.

the class GridLayoutTests method test_overscrollAtStartAfterEnd.

@Test
public void test_overscrollAtStartAfterEnd() throws Exception {
    final int numItems = 1;
    final int dy = 100;
    RecyclerView.Adapter adapter;
    int[] layoutPadding;
    adapter = new TestAdapterBuilder().addGridSection(numItems, Utils.RV_WIDTH, Utils.RV_HEIGHT + dy, null).build(mActivity);
    layoutPadding = new int[] { 0, 0, 0, 0 };
    Utils.doOverscrollTest(new int[] { 0, 0 }, layoutPadding, false, adapter, mLayoutManager, mRecyclerView);
}
Also used : TestAdapterBuilder(com.tonicartos.superslim.util.TestAdapterBuilder) RecyclerView(android.support.v7.widget.RecyclerView) Test(org.junit.Test)

Example 3 with TestAdapterBuilder

use of com.tonicartos.superslim.util.TestAdapterBuilder in project SuperSLiM by TonicArtos.

the class GridLayoutTests method test_overscrollAfterStartAtEnd.

@Test
public void test_overscrollAfterStartAtEnd() throws Exception {
    final int numItems = 1;
    final int dy = 100;
    RecyclerView.Adapter adapter;
    int[] layoutPadding;
    adapter = new TestAdapterBuilder().addGridSection(numItems, Utils.RV_WIDTH, Utils.RV_HEIGHT - dy, null).build(mActivity);
    layoutPadding = new int[] { 0, 0, 0, 0 };
    Utils.doOverscrollTest(new int[] { 0, dy }, layoutPadding, true, adapter, mLayoutManager, mRecyclerView);
}
Also used : TestAdapterBuilder(com.tonicartos.superslim.util.TestAdapterBuilder) RecyclerView(android.support.v7.widget.RecyclerView) Test(org.junit.Test)

Example 4 with TestAdapterBuilder

use of com.tonicartos.superslim.util.TestAdapterBuilder in project SuperSLiM by TonicArtos.

the class GridLayoutTests method test_overscrollAfterStartBeforeEnd.

@Test
public void test_overscrollAfterStartBeforeEnd() throws Exception {
    final int numItems = 1;
    final int dy = 100;
    RecyclerView.Adapter adapter;
    int[] layoutPadding;
    adapter = new TestAdapterBuilder().addGridSection(numItems, Utils.RV_WIDTH, Utils.RV_HEIGHT - dy * 2, null).build(mActivity);
    layoutPadding = new int[] { 0, 0, 0, 0 };
    Utils.doOverscrollTest(new int[] { 0, dy }, layoutPadding, true, adapter, mLayoutManager, mRecyclerView);
}
Also used : TestAdapterBuilder(com.tonicartos.superslim.util.TestAdapterBuilder) RecyclerView(android.support.v7.widget.RecyclerView) Test(org.junit.Test)

Example 5 with TestAdapterBuilder

use of com.tonicartos.superslim.util.TestAdapterBuilder in project SuperSLiM by TonicArtos.

the class GridLayoutTests method test_findLastVisibleItemOfScrolledSectionsWithHeaders.

@Test
public void test_findLastVisibleItemOfScrolledSectionsWithHeaders() {
    RecyclerView.Adapter adapter = new TestAdapterBuilder().addGridSection(5, Utils.RV_WIDTH, 100, TestAdapterBuilder.Header.with(TestAdapterBuilder.Header.INLINE)).addGridSection(5, Utils.RV_WIDTH, 100, TestAdapterBuilder.Header.with(TestAdapterBuilder.Header.INLINE)).addGridSection(5, Utils.RV_WIDTH, 100, TestAdapterBuilder.Header.with(TestAdapterBuilder.Header.INLINE)).addGridSection(5, Utils.RV_WIDTH, 100, TestAdapterBuilder.Header.with(TestAdapterBuilder.Header.INLINE)).addGridSection(5, Utils.RV_WIDTH, 100, TestAdapterBuilder.Header.with(TestAdapterBuilder.Header.INLINE)).addGridSection(5, Utils.RV_WIDTH, 100, TestAdapterBuilder.Header.with(TestAdapterBuilder.Header.INLINE)).addGridSection(5, Utils.RV_WIDTH, 100, TestAdapterBuilder.Header.with(TestAdapterBuilder.Header.INLINE)).addGridSection(5, Utils.RV_WIDTH, 100, TestAdapterBuilder.Header.with(TestAdapterBuilder.Header.INLINE)).build(mActivity);
    Utils.setupLayoutTest(null, adapter, mLayoutManager, mRecyclerView);
    assertEquals(20, mLayoutManager.findLastVisibleItemPosition());
    mRecyclerView.scrollBy(0, 150);
    assertEquals(24, mLayoutManager.findLastVisibleItemPosition());
}
Also used : TestAdapterBuilder(com.tonicartos.superslim.util.TestAdapterBuilder) RecyclerView(android.support.v7.widget.RecyclerView) Test(org.junit.Test)

Aggregations

RecyclerView (android.support.v7.widget.RecyclerView)22 TestAdapterBuilder (com.tonicartos.superslim.util.TestAdapterBuilder)22 Test (org.junit.Test)22