Search in sources :

Example 16 with DialogPlusBuilder

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

the class DialogPlusBuilderTest method testDefaultContentMarginWhenGravityIsNotCenter.

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

Example 17 with DialogPlusBuilder

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

the class DialogPlusBuilderTest method testGravity.

@Test
public void testGravity() {
    DialogPlusBuilder builder = DialogPlus.newDialog(context);
    //default should be bottom
    FrameLayout.LayoutParams params = builder.getContentParams();
    assertThat(params.gravity).isEqualTo(Gravity.BOTTOM);
    // set different gravity
    builder.setGravity(Gravity.TOP);
    assertThat(params.gravity).isEqualTo(Gravity.TOP);
    //set combination
    builder.setGravity(Gravity.TOP | Gravity.CENTER);
    assertThat(params.gravity).isEqualTo(Gravity.TOP | Gravity.CENTER);
}
Also used : DialogPlusBuilder(com.orhanobut.dialogplus.DialogPlusBuilder) FrameLayout(android.widget.FrameLayout) Test(org.junit.Test)

Example 18 with DialogPlusBuilder

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

the class DialogPlusBuilderTest method testSetOnDismissListener.

@Test
public void testSetOnDismissListener() {
    DialogPlusBuilder builder = DialogPlus.newDialog(context);
    assertThat(builder.getOnDismissListener()).isNull();
    OnDismissListener listener = new OnDismissListener() {

        @Override
        public void onDismiss(DialogPlus dialog) {
        }
    };
    builder.setOnDismissListener(listener);
    assertThat(builder.getOnDismissListener()).isNotNull();
    assertThat(builder.getOnDismissListener()).isEqualTo(listener);
}
Also used : DialogPlus(com.orhanobut.dialogplus.DialogPlus) DialogPlusBuilder(com.orhanobut.dialogplus.DialogPlusBuilder) OnDismissListener(com.orhanobut.dialogplus.OnDismissListener) Test(org.junit.Test)

Example 19 with DialogPlusBuilder

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

the class DialogPlusBuilderTest method create_shouldNotReturnNull.

@Test
public void create_shouldNotReturnNull() {
    DialogPlusBuilder builder = DialogPlus.newDialog(context);
    assertThat(builder.create()).isNotNull();
}
Also used : DialogPlusBuilder(com.orhanobut.dialogplus.DialogPlusBuilder) Test(org.junit.Test)

Example 20 with DialogPlusBuilder

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

the class DialogPlusBuilderTest method testSetOnClickListener.

@Test
public void testSetOnClickListener() {
    DialogPlusBuilder builder = DialogPlus.newDialog(context);
    assertThat(builder.getOnClickListener()).isNull();
    OnClickListener clickListener = new OnClickListener() {

        @Override
        public void onClick(DialogPlus dialog, View view) {
        }
    };
    builder.setOnClickListener(clickListener);
    assertThat(builder.getOnClickListener()).isNotNull();
    assertThat(builder.getOnClickListener()).isEqualTo(clickListener);
}
Also used : DialogPlus(com.orhanobut.dialogplus.DialogPlus) DialogPlusBuilder(com.orhanobut.dialogplus.DialogPlusBuilder) OnClickListener(com.orhanobut.dialogplus.OnClickListener) View(android.view.View) 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