use of com.orhanobut.dialogplus.DialogPlusBuilder in project dialogplus by orhanobut.
the class DialogPlusBuilderTest method constructorShouldNotAcceptNull.
@Test
public void constructorShouldNotAcceptNull() {
try {
DialogPlus.newDialog(null);
fail();
} catch (Exception e) {
assertThat(e).hasMessage("Context may not be null");
}
DialogPlusBuilder builder = DialogPlus.newDialog(context);
assertThat(builder).isNotNull();
}
use of com.orhanobut.dialogplus.DialogPlusBuilder in project dialogplus by orhanobut.
the class DialogPlusBuilderTest method testContentLayoutParams_whenExpandedTrueWithHeightAndNotSet.
@Test
public void testContentLayoutParams_whenExpandedTrueWithHeightAndNotSet() {
DialogPlusBuilder builder = DialogPlus.newDialog(context);
builder.setExpanded(true, 100);
assertThat(builder.getContentParams()).isInstanceOf(FrameLayout.LayoutParams.class);
//when not expanded
FrameLayout.LayoutParams params = builder.getContentParams();
assertThat(builder.isExpanded()).isTrue();
assertThat(params.width).isEqualTo(ViewGroup.LayoutParams.MATCH_PARENT);
assertThat(params.height).isEqualTo(100);
assertThat(params.gravity).isEqualTo(Gravity.BOTTOM);
}
use of com.orhanobut.dialogplus.DialogPlusBuilder in project dialogplus by orhanobut.
the class DialogPlusBuilderTest method testSetContentWidth.
@Test
public void testSetContentWidth() {
DialogPlusBuilder builder = DialogPlus.newDialog(context);
builder.setContentWidth(100);
FrameLayout.LayoutParams params = builder.getContentParams();
assertThat(params.width).isEqualTo(100);
}
use of com.orhanobut.dialogplus.DialogPlusBuilder in project dialogplus by orhanobut.
the class DialogPlusBuilderTest method testSetContentHeight.
@Test
public void testSetContentHeight() {
DialogPlusBuilder builder = DialogPlus.newDialog(context);
builder.setContentHeight(100);
FrameLayout.LayoutParams params = builder.getContentParams();
assertThat(params.height).isEqualTo(100);
}
use of com.orhanobut.dialogplus.DialogPlusBuilder in project dialogplus by orhanobut.
the class DialogPlusBuilderTest method testOutMostParams.
@Test
public void testOutMostParams() {
DialogPlusBuilder builder = DialogPlus.newDialog(context);
FrameLayout.LayoutParams params = builder.getOutmostLayoutParams();
assertThat(params.width).isEqualTo(ViewGroup.LayoutParams.MATCH_PARENT);
assertThat(params.height).isEqualTo(ViewGroup.LayoutParams.MATCH_PARENT);
// default should be 0 for all
assertThat(params.leftMargin).isEqualTo(0);
assertThat(params.rightMargin).isEqualTo(0);
assertThat(params.topMargin).isEqualTo(0);
assertThat(params.bottomMargin).isEqualTo(0);
//set new margin
builder.setOutMostMargin(1, 2, 3, 4);
params = builder.getOutmostLayoutParams();
assertThat(params.leftMargin).isEqualTo(1);
assertThat(params.topMargin).isEqualTo(2);
assertThat(params.rightMargin).isEqualTo(3);
assertThat(params.bottomMargin).isEqualTo(4);
}
Aggregations