Search in sources :

Example 11 with DialogPlusBuilder

use of com.orhanobut.dialogplus.DialogPlusBuilder in project dialogplus by orhanobut.

the class DialogPlusBuilderTest method testExpanded.

@Test
public void testExpanded() {
    DialogPlusBuilder builder = DialogPlus.newDialog(context);
    //default should be false
    assertThat(builder.isExpanded()).isFalse();
    builder.setExpanded(true);
    assertThat(builder.isExpanded()).isTrue();
}
Also used : DialogPlusBuilder(com.orhanobut.dialogplus.DialogPlusBuilder) Test(org.junit.Test)

Example 12 with DialogPlusBuilder

use of com.orhanobut.dialogplus.DialogPlusBuilder in project dialogplus by orhanobut.

the class DialogPlusBuilderTest method testPadding.

@Test
public void testPadding() {
    DialogPlusBuilder builder = DialogPlus.newDialog(context);
    //default 0
    int[] padding = builder.getContentPadding();
    assertThat(padding[0]).isEqualTo(0);
    assertThat(padding[1]).isEqualTo(0);
    assertThat(padding[2]).isEqualTo(0);
    assertThat(padding[3]).isEqualTo(0);
    builder.setPadding(1, 2, 3, 4);
    padding = builder.getContentPadding();
    assertThat(padding[0]).isEqualTo(1);
    assertThat(padding[1]).isEqualTo(2);
    assertThat(padding[2]).isEqualTo(3);
    assertThat(padding[3]).isEqualTo(4);
}
Also used : DialogPlusBuilder(com.orhanobut.dialogplus.DialogPlusBuilder) Test(org.junit.Test)

Example 13 with DialogPlusBuilder

use of com.orhanobut.dialogplus.DialogPlusBuilder in project dialogplus by orhanobut.

the class DialogPlusBuilderTest method testContentMarginWhenSet.

@Test
public void testContentMarginWhenSet() {
    DialogPlusBuilder builder = DialogPlus.newDialog(context);
    builder.setMargin(1, 2, 3, 4);
    int[] margin = builder.getContentMargin();
    assertThat(margin[0]).isEqualTo(1);
    assertThat(margin[1]).isEqualTo(2);
    assertThat(margin[2]).isEqualTo(3);
    assertThat(margin[3]).isEqualTo(4);
}
Also used : DialogPlusBuilder(com.orhanobut.dialogplus.DialogPlusBuilder) Test(org.junit.Test)

Example 14 with DialogPlusBuilder

use of com.orhanobut.dialogplus.DialogPlusBuilder in project dialogplus by orhanobut.

the class DialogPlusBuilderTest method testSetContentHolder.

@Test
public void testSetContentHolder() {
    DialogPlusBuilder builder = DialogPlus.newDialog(context);
    //Test ListHolder
    ListHolder listHolder = new ListHolder();
    builder.setContentHolder(listHolder);
    assertThat(builder.getHolder()).isEqualTo(listHolder);
    //test GridHolder
    GridHolder gridHolder = new GridHolder(3);
    builder.setContentHolder(gridHolder);
    assertThat(builder.getHolder()).isEqualTo(gridHolder);
    //test ViewHolder
    ViewHolder viewHolder = new ViewHolder(new LinearLayout(context));
    builder.setContentHolder(viewHolder);
    assertThat(builder.getHolder()).isEqualTo(viewHolder);
    //should accept null
    builder.setContentHolder(null);
}
Also used : ViewHolder(com.orhanobut.dialogplus.ViewHolder) DialogPlusBuilder(com.orhanobut.dialogplus.DialogPlusBuilder) GridHolder(com.orhanobut.dialogplus.GridHolder) ListHolder(com.orhanobut.dialogplus.ListHolder) LinearLayout(android.widget.LinearLayout) Test(org.junit.Test)

Example 15 with DialogPlusBuilder

use of com.orhanobut.dialogplus.DialogPlusBuilder in project dialogplus by orhanobut.

the class DialogPlusBuilderTest method testHeader.

@Test
public void testHeader() {
    DialogPlusBuilder builder = DialogPlus.newDialog(context);
    builder.setHeader(android.R.layout.simple_list_item_1);
    assertThat(builder.getHeaderView()).isNotNull();
    LinearLayout headerView = new LinearLayout(context);
    builder.setHeader(headerView);
    assertThat(builder.getHeaderView()).isEqualTo(headerView);
}
Also used : DialogPlusBuilder(com.orhanobut.dialogplus.DialogPlusBuilder) LinearLayout(android.widget.LinearLayout) Test(org.junit.Test)

Aggregations

DialogPlusBuilder (com.orhanobut.dialogplus.DialogPlusBuilder)28 Test (org.junit.Test)28 FrameLayout (android.widget.FrameLayout)7 DialogPlus (com.orhanobut.dialogplus.DialogPlus)5 LinearLayout (android.widget.LinearLayout)3 View (android.view.View)2 ArrayAdapter (android.widget.ArrayAdapter)1 GridHolder (com.orhanobut.dialogplus.GridHolder)1 ListHolder (com.orhanobut.dialogplus.ListHolder)1 OnBackPressListener (com.orhanobut.dialogplus.OnBackPressListener)1 OnCancelListener (com.orhanobut.dialogplus.OnCancelListener)1 OnClickListener (com.orhanobut.dialogplus.OnClickListener)1 OnDismissListener (com.orhanobut.dialogplus.OnDismissListener)1 OnItemClickListener (com.orhanobut.dialogplus.OnItemClickListener)1 ViewHolder (com.orhanobut.dialogplus.ViewHolder)1