Search in sources :

Example 6 with ConfigDefinition

use of org.apmem.tools.layouts.logic.ConfigDefinition 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);
}
Also used : ViewDefinition(org.apmem.tools.layouts.logic.ViewDefinition) LineDefinition(org.apmem.tools.layouts.logic.LineDefinition) ConfigDefinition(org.apmem.tools.layouts.logic.ConfigDefinition) Test(org.junit.Test)

Example 7 with ConfigDefinition

use of org.apmem.tools.layouts.logic.ConfigDefinition 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));
}
Also used : ViewDefinition(org.apmem.tools.layouts.logic.ViewDefinition) LineDefinition(org.apmem.tools.layouts.logic.LineDefinition) ConfigDefinition(org.apmem.tools.layouts.logic.ConfigDefinition) Test(org.junit.Test)

Example 8 with ConfigDefinition

use of org.apmem.tools.layouts.logic.ConfigDefinition 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());
}
Also used : ViewDefinition(org.apmem.tools.layouts.logic.ViewDefinition) LineDefinition(org.apmem.tools.layouts.logic.LineDefinition) ConfigDefinition(org.apmem.tools.layouts.logic.ConfigDefinition) Test(org.junit.Test)

Example 9 with ConfigDefinition

use of org.apmem.tools.layouts.logic.ConfigDefinition in project android-flowlayout by ApmeM.

the class LineDefinitionTests method CanFit_LengthLessThenRemainingIsOk.

@Test
public void CanFit_LengthLessThenRemainingIsOk() {
    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(view1);
    Assert.assertTrue(canFit);
}
Also used : ViewDefinition(org.apmem.tools.layouts.logic.ViewDefinition) LineDefinition(org.apmem.tools.layouts.logic.LineDefinition) ConfigDefinition(org.apmem.tools.layouts.logic.ConfigDefinition) Test(org.junit.Test)

Example 10 with ConfigDefinition

use of org.apmem.tools.layouts.logic.ConfigDefinition in project android-flowlayout by ApmeM.

the class LineDefinitionTests method AddView_TakesLayoutMarginsIntoAccount.

@Test
public void AddView_TakesLayoutMarginsIntoAccount() {
    ViewDefinition view1 = CreateView(12, 34);
    ViewDefinition view2 = CreateView(56, 78);
    view1.setMargins(1, 1, 1, 1);
    view2.setMargins(1, 1, 1, 1);
    ConfigDefinition config = new ConfigDefinition();
    config.setMaxWidth(100);
    LineDefinition def = new LineDefinition(config);
    def.addView(view1);
    def.addView(view2);
    Assert.assertEquals(72, def.getLineLength());
    Assert.assertEquals(80, def.getLineThickness());
}
Also used : ViewDefinition(org.apmem.tools.layouts.logic.ViewDefinition) LineDefinition(org.apmem.tools.layouts.logic.LineDefinition) ConfigDefinition(org.apmem.tools.layouts.logic.ConfigDefinition) Test(org.junit.Test)

Aggregations

ConfigDefinition (org.apmem.tools.layouts.logic.ConfigDefinition)14 ViewDefinition (org.apmem.tools.layouts.logic.ViewDefinition)14 LineDefinition (org.apmem.tools.layouts.logic.LineDefinition)13 Test (org.junit.Test)13 ArrayList (java.util.ArrayList)6