Skip to content

Commit

Permalink
Tagging 1.5.0-beta.8
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcashman committed May 14, 2017
1 parent 7a8744f commit 8776fca
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def docProjects() {
subprojects.findAll { !it.name.contains('uat') }
}

def projectVersion = '1.5.0-SNAPSHOT';
def projectVersion = '1.5.0-beta.8';

configure(docProjects()) {
apply plugin: "java"
Expand Down
29 changes: 29 additions & 0 deletions ui/src/test/java/org/mini2Dx/ui/layout/FlexDirectionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@
import java.util.ArrayList;
import java.util.List;

import org.jmock.Expectations;
import org.jmock.Mockery;
import org.jmock.lib.legacy.ClassImposteriser;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mini2Dx.ui.dummy.DummyParentRenderNode;
import org.mini2Dx.ui.dummy.DummyParentUiElement;
import org.mini2Dx.ui.dummy.DummyRenderNode;
import org.mini2Dx.ui.dummy.DummyUiElement;
import org.mini2Dx.ui.element.Visibility;
import org.mini2Dx.ui.render.RenderNode;
import org.mini2Dx.ui.render.UiContainerRenderTree;

import junit.framework.Assert;

Expand All @@ -22,14 +28,37 @@
public class FlexDirectionTest {
private static final int TOTAL_CHILDREN = 4;

private Mockery mockery;
private LayoutState layoutState;
private UiContainerRenderTree renderTree;

private final DummyParentUiElement parentElement = new DummyParentUiElement();
private final List<DummyUiElement> children = new ArrayList<DummyUiElement>(1);
private final List<RenderNode<?, ?>> childrenRenderNodes = new ArrayList<RenderNode<?, ?>>(1);

private DummyParentRenderNode parentRenderNode;

@Before
public void setUp() {
mockery = new Mockery();
mockery.setImposteriser(ClassImposteriser.INSTANCE);

layoutState = mockery.mock(LayoutState.class);
renderTree = mockery.mock(UiContainerRenderTree.class);

mockery.checking(new Expectations() {
{
atLeast(1).of(layoutState).getUiContainerRenderTree();
will(returnValue(renderTree));
}
});
}

@After
public void teardown() {
mockery.assertIsSatisfied();
}

@Test
public void testColumn() {
setUpPreferredSizes(300f, 100f);
Expand Down
5 changes: 5 additions & 0 deletions ui/src/test/java/org/mini2Dx/ui/render/RenderLayerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
public class RenderLayerTest {
private Mockery mockery;
private LayoutState layoutState;
private UiContainerRenderTree renderTree;

private DummyParentUiElement parentElement = new DummyParentUiElement();
private DummyUiElement uiElement1 = new DummyUiElement();
Expand All @@ -53,6 +54,8 @@ public void setUp() {
mockery.setImposteriser(ClassImposteriser.INSTANCE);

layoutState = mockery.mock(LayoutState.class);
renderTree = mockery.mock(UiContainerRenderTree.class);

renderLayer.add(renderNode1);
renderLayer.add(renderNode2);
}
Expand Down Expand Up @@ -339,6 +342,8 @@ public void testPreferredHeightWrappedWithPaddingAndNegativeMargin() {
private void configureParentWithWidth(final float parentWidth) {
mockery.checking(new Expectations() {
{
atLeast(1).of(layoutState).getUiContainerRenderTree();
will(returnValue(renderTree));
one(layoutState).getParentWidth();
will(returnValue(parentWidth));
atLeast(1).of(layoutState).setParentWidth(with(any(Float.class)));
Expand Down
32 changes: 32 additions & 0 deletions ui/src/test/java/org/mini2Dx/ui/render/RenderNodeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class RenderNodeTest {

private Mockery mockery;
private LayoutState layoutState;
private UiContainerRenderTree renderTree;

private DummyParentUiElement parentElement = new DummyParentUiElement();
private DummyUiElement uiElement = new DummyUiElement();
Expand All @@ -59,6 +60,7 @@ public void setUp() {
mockery.setImposteriser(ClassImposteriser.INSTANCE);

layoutState = mockery.mock(LayoutState.class);
renderTree = mockery.mock(UiContainerRenderTree.class);
}

@After
Expand Down Expand Up @@ -190,6 +192,13 @@ public void testRenderCoordinatesWithChildAndParentMarginAndPadding() {

@Test
public void testPreferredSize() {
mockery.checking(new Expectations() {
{
atLeast(1).of(layoutState).getUiContainerRenderTree();
will(returnValue(renderTree));
}
});

final float preferredWidth = 150f;
final float preferredHeight = 200f;

Expand All @@ -208,6 +217,13 @@ public void testPreferredSize() {

@Test
public void testPreferredSizeWithPadding() {
mockery.checking(new Expectations() {
{
atLeast(1).of(layoutState).getUiContainerRenderTree();
will(returnValue(renderTree));
}
});

final int padding = 20;
final float preferredWidth = 150f;
final float preferredHeight = 200f;
Expand All @@ -228,6 +244,13 @@ public void testPreferredSizeWithPadding() {

@Test
public void testPreferredSizeWithMargin() {
mockery.checking(new Expectations() {
{
atLeast(1).of(layoutState).getUiContainerRenderTree();
will(returnValue(renderTree));
}
});

final int padding = 20;
final int margin = 35;
final float preferredWidth = 150f;
Expand All @@ -250,6 +273,13 @@ public void testPreferredSizeWithMargin() {

@Test
public void testPreferredSizeWithNegativeMargin() {
mockery.checking(new Expectations() {
{
atLeast(1).of(layoutState).getUiContainerRenderTree();
will(returnValue(renderTree));
}
});

final int padding = 20;
final int margin = -35;
final float preferredWidth = 150f;
Expand All @@ -273,6 +303,8 @@ public void testPreferredSizeWithNegativeMargin() {
private void configureParentWidth() {
mockery.checking(new Expectations() {
{
atLeast(1).of(layoutState).getUiContainerRenderTree();
will(returnValue(renderTree));
atLeast(1).of(layoutState).getParentWidth();
will(returnValue(0f + PARENT_WIDTH));
atLeast(1).of(layoutState).setParentWidth(with(any(Float.class)));
Expand Down
4 changes: 4 additions & 0 deletions ui/src/test/java/org/mini2Dx/ui/render/RowRenderNodeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class RowRenderNodeTest {
private Mockery mockery;
private UiTheme theme;
private LayoutState layoutState;
private UiContainerRenderTree renderTree;

private Row row = new Row();
private RowRenderNode rowRenderNode = new RowRenderNode(null, row);
Expand All @@ -50,6 +51,7 @@ public void setUp() {
mockery.setImposteriser(ClassImposteriser.INSTANCE);

layoutState = mockery.mock(LayoutState.class);
renderTree = mockery.mock(UiContainerRenderTree.class);
theme = mockery.mock(UiTheme.class);

row.setVisibility(Visibility.VISIBLE);
Expand Down Expand Up @@ -314,6 +316,8 @@ public void testPreferredHeightWrappedWithPaddingAndNegativeMargin() {
private void configureParentWithWidth(final float parentWidth) {
mockery.checking(new Expectations() {
{
atLeast(1).of(layoutState).getUiContainerRenderTree();
will(returnValue(renderTree));
atLeast(1).of(layoutState).getTheme();
will(returnValue(theme));
atLeast(1).of(layoutState).getScreenSize();
Expand Down

0 comments on commit 8776fca

Please sign in to comment.