use of org.apmem.tools.layouts.logic.LineDefinition in project android-flowlayout by ApmeM.
the class CommonLogicTests method GravityApplyUseAllAvailableSpaceHorizontallyWithLastPixel.
@Test
public void GravityApplyUseAllAvailableSpaceHorizontallyWithLastPixel() {
ConfigDefinition config = new ConfigDefinition();
config.setMaxWidth(31);
config.setMaxHeight(20);
config.setGravity(Gravity.FILL);
ArrayList<LineDefinition> lines = new ArrayList<>();
ArrayList<ViewDefinition> views = new ArrayList<>();
for (int i = 0; i < 4; i++) {
ViewDefinition view = new ViewDefinition(config, null);
view.setWidth(10);
view.setHeight(10);
views.add(view);
}
CommonLogic.fillLines(views, lines, config);
CommonLogic.calculateLinesAndChildPosition(lines);
CommonLogic.applyGravityToLines(lines, 31, 20, config);
Assert.assertEquals(2, lines.size());
Assert.assertEquals(10, lines.get(0).getViews().get(0).getWidth());
Assert.assertEquals(10, lines.get(0).getViews().get(1).getWidth());
Assert.assertEquals(11, lines.get(0).getViews().get(2).getWidth());
}
Aggregations