use of com.orhanobut.dialogplus.DialogPlusBuilder in project dialogplus by orhanobut.
the class DialogPlusBuilderTest method testSetOnCancelListener.
@Test
public void testSetOnCancelListener() {
DialogPlusBuilder builder = DialogPlus.newDialog(context);
assertThat(builder.getOnCancelListener()).isNull();
OnCancelListener listener = new OnCancelListener() {
@Override
public void onCancel(DialogPlus dialog) {
}
};
builder.setOnCancelListener(listener);
assertThat(builder.getOnCancelListener()).isNotNull();
assertThat(builder.getOnCancelListener()).isEqualTo(listener);
}
use of com.orhanobut.dialogplus.DialogPlusBuilder in project dialogplus by orhanobut.
the class DialogPlusBuilderTest method testContentLayoutParams_whenExpandedFalseAndNotSet.
@Test
public void testContentLayoutParams_whenExpandedFalseAndNotSet() {
DialogPlusBuilder builder = DialogPlus.newDialog(context);
assertThat(builder.getContentParams()).isInstanceOf(FrameLayout.LayoutParams.class);
//when not expanded
FrameLayout.LayoutParams params = builder.getContentParams();
assertThat(builder.isExpanded()).isFalse();
assertThat(params.width).isEqualTo(ViewGroup.LayoutParams.MATCH_PARENT);
assertThat(params.height).isEqualTo(ViewGroup.LayoutParams.WRAP_CONTENT);
assertThat(params.gravity).isEqualTo(Gravity.BOTTOM);
}
use of com.orhanobut.dialogplus.DialogPlusBuilder in project dialogplus by orhanobut.
the class DialogPlusBuilderTest method testFooter.
@Test
public void testFooter() {
DialogPlusBuilder builder = DialogPlus.newDialog(context);
builder.setFooter(android.R.layout.simple_list_item_1);
assertThat(builder.getFooterView()).isNotNull();
LinearLayout footerView = new LinearLayout(context);
builder.setFooter(footerView);
assertThat(builder.getFooterView()).isEqualTo(footerView);
}
use of com.orhanobut.dialogplus.DialogPlusBuilder in project dialogplus by orhanobut.
the class DialogPlusBuilderTest method testSetOnItemClickListener.
@Test
public void testSetOnItemClickListener() {
DialogPlusBuilder builder = DialogPlus.newDialog(context);
assertThat(builder.getOnItemClickListener()).isNull();
OnItemClickListener listener = new OnItemClickListener() {
@Override
public void onItemClick(DialogPlus dialog, Object item, View view, int position) {
}
};
builder.setOnItemClickListener(listener);
assertThat(builder.getOnItemClickListener()).isNotNull();
assertThat(builder.getOnItemClickListener()).isEqualTo(listener);
}
use of com.orhanobut.dialogplus.DialogPlusBuilder in project dialogplus by orhanobut.
the class DialogPlusBuilderTest method testSetCancelable.
@Test
public void testSetCancelable() {
DialogPlusBuilder builder = DialogPlus.newDialog(context);
//default should be true
assertThat(builder.isCancelable()).isTrue();
builder.setCancelable(false);
assertThat(builder.isCancelable()).isFalse();
}
Aggregations