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);
}
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);
}
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);
}
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();
}
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);
}
Aggregations