use of org.apmem.tools.layouts.logic.ViewDefinition in project android-flowlayout by ApmeM.
the class LineDefinitionTests method CreateView.
private ViewDefinition CreateView(int length, int thickness) {
ViewDefinition view = new ViewDefinition(new ConfigDefinition(), null);
view.setLength(length);
view.setThickness(thickness);
return view;
}
use of org.apmem.tools.layouts.logic.ViewDefinition in project android-flowlayout by ApmeM.
the class LineDefinitionTests method AddView_IncreaseLineLengthForChildLength.
@Test
public void AddView_IncreaseLineLengthForChildLength() {
ViewDefinition view1 = CreateView(12, 34);
ViewDefinition view2 = CreateView(56, 78);
ConfigDefinition config = new ConfigDefinition();
config.setMaxWidth(100);
LineDefinition def = new LineDefinition(config);
def.addView(view1);
def.addView(view2);
Assert.assertEquals(68, def.getLineLength());
}
use of org.apmem.tools.layouts.logic.ViewDefinition in project android-flowlayout by ApmeM.
the class LineDefinitionTests method CanFit_LengthMoreThenRemainingIsNotOk.
@Test
public void CanFit_LengthMoreThenRemainingIsNotOk() {
ViewDefinition view1 = CreateView(12, 34);
ViewDefinition view2 = CreateView(56, 78);
ConfigDefinition config = new ConfigDefinition();
config.setMaxWidth(100);
LineDefinition def = new LineDefinition(config);
def.addView(view1);
def.addView(view2);
boolean canFit = def.canFit(view2);
Assert.assertFalse(canFit);
}
use of org.apmem.tools.layouts.logic.ViewDefinition in project android-flowlayout by ApmeM.
the class LineDefinitionTests method AddView_AddViewIntoList.
@Test
public void AddView_AddViewIntoList() {
ViewDefinition view1 = CreateView(12, 34);
ViewDefinition view2 = CreateView(56, 78);
ConfigDefinition config = new ConfigDefinition();
config.setMaxWidth(100);
LineDefinition def = new LineDefinition(config);
def.addView(view1);
def.addView(view2);
Assert.assertEquals(view1, def.getViews().get(0));
Assert.assertEquals(view2, def.getViews().get(1));
}
use of org.apmem.tools.layouts.logic.ViewDefinition in project android-flowlayout by ApmeM.
the class LineDefinitionTests method AddView_SetThicknessToMaxBetweenThickness.
@Test
public void AddView_SetThicknessToMaxBetweenThickness() {
ViewDefinition view1 = CreateView(12, 34);
ViewDefinition view2 = CreateView(56, 78);
ConfigDefinition config = new ConfigDefinition();
config.setMaxWidth(100);
LineDefinition def = new LineDefinition(config);
def.addView(view1);
def.addView(view2);
Assert.assertEquals(78, def.getLineThickness());
}
Aggregations