Return-Path: X-Original-To: apmail-incubator-isis-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-isis-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3BF282617 for ; Tue, 3 May 2011 07:20:18 +0000 (UTC) Received: (qmail 83299 invoked by uid 500); 3 May 2011 07:20:18 -0000 Delivered-To: apmail-incubator-isis-commits-archive@incubator.apache.org Received: (qmail 83179 invoked by uid 500); 3 May 2011 07:20:17 -0000 Mailing-List: contact isis-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: isis-dev@incubator.apache.org Delivered-To: mailing list isis-commits@incubator.apache.org Received: (qmail 83068 invoked by uid 99); 3 May 2011 07:20:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 07:20:12 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 May 2011 07:20:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 67E4D2388C6E; Tue, 3 May 2011 07:18:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1098945 [25/25] - in /incubator/isis/trunk/viewer: bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/ bdd/common/src/main/java/org/apache/isis/viewer/bdd/common/components/ bdd/common/src/main/java/org/apache/isis/viewer/bdd/commo... Date: Tue, 03 May 2011 07:18:38 -0000 To: isis-commits@incubator.apache.org From: danhaywood@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110503071848.67E4D2388C6E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/tree/TreeBrowserFrameTest.java URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/tree/TreeBrowserFrameTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff ============================================================================== --- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/tree/TreeBrowserFrameTest.java (original) +++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/tree/TreeBrowserFrameTest.java Tue May 3 07:18:19 2011 @@ -17,9 +17,8 @@ * under the License. */ +package org.apache.isis.viewer.dnd.viewer.tree; -package org.apache.isis.viewer.dnd.viewer.tree; - import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext; import org.apache.isis.runtimes.dflt.runtime.testsystem.ProxyJunit3TestCase; import org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyConfiguration; @@ -32,157 +31,150 @@ import org.apache.isis.viewer.dnd.drawin import org.apache.isis.viewer.dnd.drawing.Size; import org.apache.isis.viewer.dnd.view.View; import org.apache.isis.viewer.dnd.view.composite.MasterDetailPanel; - - -/* - * Note that the frame only contains two views and no additional spacing, hence no drawing. The - * width is the total of the two decorated views, while the height is the largest of the two. - */ -public class TreeBrowserFrameTest extends ProxyJunit3TestCase { - - - public static void main(final String[] args) { - junit.textui.TestRunner.run(TreeBrowserFrameTest.class); - } - - private DummyWorkspaceView dummyWorkspace; - private MasterDetailPanel frame; - - @Override - protected void setUp() throws Exception { - super.setUp(); - - IsisContext.setConfiguration(new TestProxyConfiguration()); - TestToolkit.createInstance(); - - dummyWorkspace = new DummyWorkspaceView(); - - final DummyContent content = new DummyContent() {}; - final DummyViewSpecification rhsSpec = new DummyViewSpecification(); - rhsSpec.setupCreatedViewsSize(new Size(200, 300)); - final DummyViewSpecification lhsSpec = new DummyViewSpecification(); - lhsSpec.setupCreatedViewsSize(new Size(350, 250)); - frame = new MasterDetailPanel(content, rhsSpec, lhsSpec); - frame.setParent(dummyWorkspace); - } - - public void testViewsParents() throws Exception { - View[] subviews = frame.getSubviews(); - assertEquals(2, subviews.length); - View lhsView = subviews[0]; - assertEquals(frame, lhsView.getParent()); - View rhsView = subviews[1]; - assertEquals(frame, rhsView.getParent()); - } - - public void testLeftViewSize() { - // width => width of view (150) + scroll border (0) + resize border (7) => 159 - // height => height of view (250) + scroll border (0) => 250 - assertEquals(leftView(), leftView().getView()); - assertEquals(new Size(350 + 7, 250), leftView().getView().getRequiredSize(Size.createMax())); - } - - public void testInitialBlankViewSize() { - // 120 is the minimum width given to the blan view by the MasterDetailPanel - assertEquals(new Size(120, 0), rightView().getRequiredSize(Size.createMax())); - } - - public void testInitialBlankViewSizeWithinALimitedSpace() { - assertEquals(new Size(100, 0), rightView().getRequiredSize(new Size(100, 200))); - } - - private View leftView() { - return frame.getSubviews()[0]; - } - - private View rightView() { - return frame.getSubviews()[1]; - } - - public void testTotalRequiredSize() { - assertEquals(new Size(350 + 7 + 120, 250), frame.getRequiredSize(Size.createMax())); - } - - public void testInitialSize() { - assertEquals(new Size(), frame.getSize()); - } - - - public void testLayoutInReducedSpaceReducesSizeOfLeftView() { - layoutFrameInReducedSpace(); - assertEquals("retains original size", new Size(400 - 120, 200), leftView().getSize()); - - - // scroll border 16 pixels; resize border 5 pixels; total 21 pixels - // assertEquals("width reduces", new Size(100, 200), rightView.getSize()); - - // assertEquals(new Location(100, 0), rightView.getLocation()); - } - - - public void testLayoutInReducedSpaceLeaveBlanksWidthUnchangedAsIsAlreadyMinimumSize() { - layoutFrameInReducedSpace(); - assertEquals("retains original size", new Size(120, 200), rightView().getSize()); - } - - public void testLayoutInReducedSpaceReducesSizeOfRightView() { - frame.removeView(rightView()); - frame.addView(new DummyView(350, 210)); - layoutFrameInReducedSpace(); - int expectedWidth = 400 - 206 - 1; // total width - - assertEquals("retains original size", new Size(expectedWidth, 210), rightView().getSize()); - } - - public void testLayoutInReducedSpaceReducesSizeOfLeftViewInProportion() { - frame.removeView(rightView()); - frame.addView(new DummyView(350, 210)); - layoutFrameInReducedSpace(); - assertEquals("retains original size", new Size(200 + 7 -1, 210), leftView().getSize()); - } - -/* - public void testLayoutInReducedSpaceReducesSizeOfRightView() { - layoutFrameInReducedSpace(); - assertEquals("retains original size", new Size(120, 200), rightView().getSize()); - } - */ - - private void layoutFrameInReducedSpace() { - frame.invalidateLayout(); - frame.setSize(new Size(400, 200)); - frame.layout(); - } - - - public void testLayoutGivesLeftViewAllItWants() { - layoutFrameInRequiredSpace(); - assertEquals("retains original size", new Size(350 + 7, 250), leftView().getSize()); - } - - public void testLayoutGivesRightViewAllItWants() { - layoutFrameInRequiredSpace(); - assertEquals("height should be the same as left (including borders)", new Size(120, 250), rightView().getSize()); - } - - public void testLayoutLocatesLeftViewOnLeft() { - layoutFrameInRequiredSpace(); - assertEquals(new Location(), leftView().getLocation()); - } - - public void testLayoutLocatesRightViewNextToLeftView() { - layoutFrameInRequiredSpace(); - assertEquals(new Location(350 + 7, 0), rightView().getLocation()); - } - - private void layoutFrameInRequiredSpace() { - frame.invalidateLayout(); - frame.setSize(new Size(350 + 7 + 120, 250)); - frame.layout(); - } - - public void testSubviews() { - final View[] subviews = frame.getSubviews(); - assertEquals(leftView().getView(), subviews[0]); - assertEquals(rightView().getView(), subviews[1]); - } -} + +/* + * Note that the frame only contains two views and no additional spacing, hence no drawing. The + * width is the total of the two decorated views, while the height is the largest of the two. + */ +public class TreeBrowserFrameTest extends ProxyJunit3TestCase { + + public static void main(final String[] args) { + junit.textui.TestRunner.run(TreeBrowserFrameTest.class); + } + + private DummyWorkspaceView dummyWorkspace; + private MasterDetailPanel frame; + + @Override + protected void setUp() throws Exception { + super.setUp(); + + IsisContext.setConfiguration(new TestProxyConfiguration()); + TestToolkit.createInstance(); + + dummyWorkspace = new DummyWorkspaceView(); + + final DummyContent content = new DummyContent() { + }; + final DummyViewSpecification rhsSpec = new DummyViewSpecification(); + rhsSpec.setupCreatedViewsSize(new Size(200, 300)); + final DummyViewSpecification lhsSpec = new DummyViewSpecification(); + lhsSpec.setupCreatedViewsSize(new Size(350, 250)); + frame = new MasterDetailPanel(content, rhsSpec, lhsSpec); + frame.setParent(dummyWorkspace); + } + + public void testViewsParents() throws Exception { + final View[] subviews = frame.getSubviews(); + assertEquals(2, subviews.length); + final View lhsView = subviews[0]; + assertEquals(frame, lhsView.getParent()); + final View rhsView = subviews[1]; + assertEquals(frame, rhsView.getParent()); + } + + public void testLeftViewSize() { + // width => width of view (150) + scroll border (0) + resize border (7) => 159 + // height => height of view (250) + scroll border (0) => 250 + assertEquals(leftView(), leftView().getView()); + assertEquals(new Size(350 + 7, 250), leftView().getView().getRequiredSize(Size.createMax())); + } + + public void testInitialBlankViewSize() { + // 120 is the minimum width given to the blan view by the MasterDetailPanel + assertEquals(new Size(120, 0), rightView().getRequiredSize(Size.createMax())); + } + + public void testInitialBlankViewSizeWithinALimitedSpace() { + assertEquals(new Size(100, 0), rightView().getRequiredSize(new Size(100, 200))); + } + + private View leftView() { + return frame.getSubviews()[0]; + } + + private View rightView() { + return frame.getSubviews()[1]; + } + + public void testTotalRequiredSize() { + assertEquals(new Size(350 + 7 + 120, 250), frame.getRequiredSize(Size.createMax())); + } + + public void testInitialSize() { + assertEquals(new Size(), frame.getSize()); + } + + public void testLayoutInReducedSpaceReducesSizeOfLeftView() { + layoutFrameInReducedSpace(); + assertEquals("retains original size", new Size(400 - 120, 200), leftView().getSize()); + + // scroll border 16 pixels; resize border 5 pixels; total 21 pixels + // assertEquals("width reduces", new Size(100, 200), rightView.getSize()); + + // assertEquals(new Location(100, 0), rightView.getLocation()); + } + + public void testLayoutInReducedSpaceLeaveBlanksWidthUnchangedAsIsAlreadyMinimumSize() { + layoutFrameInReducedSpace(); + assertEquals("retains original size", new Size(120, 200), rightView().getSize()); + } + + public void testLayoutInReducedSpaceReducesSizeOfRightView() { + frame.removeView(rightView()); + frame.addView(new DummyView(350, 210)); + layoutFrameInReducedSpace(); + final int expectedWidth = 400 - 206 - 1; // total width - + assertEquals("retains original size", new Size(expectedWidth, 210), rightView().getSize()); + } + + public void testLayoutInReducedSpaceReducesSizeOfLeftViewInProportion() { + frame.removeView(rightView()); + frame.addView(new DummyView(350, 210)); + layoutFrameInReducedSpace(); + assertEquals("retains original size", new Size(200 + 7 - 1, 210), leftView().getSize()); + } + + /* + * public void testLayoutInReducedSpaceReducesSizeOfRightView() { layoutFrameInReducedSpace(); + * assertEquals("retains original size", new Size(120, 200), rightView().getSize()); } + */ + + private void layoutFrameInReducedSpace() { + frame.invalidateLayout(); + frame.setSize(new Size(400, 200)); + frame.layout(); + } + + public void testLayoutGivesLeftViewAllItWants() { + layoutFrameInRequiredSpace(); + assertEquals("retains original size", new Size(350 + 7, 250), leftView().getSize()); + } + + public void testLayoutGivesRightViewAllItWants() { + layoutFrameInRequiredSpace(); + assertEquals("height should be the same as left (including borders)", new Size(120, 250), rightView().getSize()); + } + + public void testLayoutLocatesLeftViewOnLeft() { + layoutFrameInRequiredSpace(); + assertEquals(new Location(), leftView().getLocation()); + } + + public void testLayoutLocatesRightViewNextToLeftView() { + layoutFrameInRequiredSpace(); + assertEquals(new Location(350 + 7, 0), rightView().getLocation()); + } + + private void layoutFrameInRequiredSpace() { + frame.invalidateLayout(); + frame.setSize(new Size(350 + 7 + 120, 250)); + frame.layout(); + } + + public void testSubviews() { + final View[] subviews = frame.getSubviews(); + assertEquals(leftView().getView(), subviews[0]); + assertEquals(rightView().getView(), subviews[1]); + } +} Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/view/AbstractViewTest.java URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/view/AbstractViewTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff ============================================================================== --- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/view/AbstractViewTest.java (original) +++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/view/AbstractViewTest.java Tue May 3 07:18:19 2011 @@ -17,7 +17,6 @@ * under the License. */ - package org.apache.isis.viewer.dnd.viewer.view; import junit.framework.TestCase; @@ -31,7 +30,6 @@ import org.apache.isis.viewer.dnd.view.V import org.apache.isis.viewer.dnd.view.base.AbstractView; import org.apache.isis.viewer.dnd.view.content.NullContent; - public class AbstractViewTest extends TestCase { private AbstractView av; @@ -41,7 +39,8 @@ public class AbstractViewTest extends Te @Override protected void setUp() throws Exception { - av = new AbstractView(new NullContent()) {}; + av = new AbstractView(new NullContent()) { + }; super.setUp(); } @@ -78,12 +77,14 @@ public class AbstractViewTest extends Te public void testBoundsSetSizeAndLocation() throws Exception { final Location l = new Location(); final Size z = new Size(); - View view = new AbstractView(new NullContent()) { - public void setLocation(Location location) { + final View view = new AbstractView(new NullContent()) { + @Override + public void setLocation(final Location location) { l.translate(location); } - public void setSize(Size size) { + @Override + public void setSize(final Size size) { z.extend(size); } }; @@ -92,7 +93,7 @@ public class AbstractViewTest extends Te assertEquals(new Location(20, 30), l); assertEquals(new Size(40, 50), z); } - + public void testRequiredSizeIsLimitedToTheMaximumSize() throws Exception { assertEquals(Size.createMax(), av.getRequiredSize(Size.createMax())); assertEquals(new Size(100, 50), av.getRequiredSize(new Size(100, 50))); Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/view/configurable/GridLayoutTest.java URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/view/configurable/GridLayoutTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff ============================================================================== --- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/view/configurable/GridLayoutTest.java (original) +++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/view/configurable/GridLayoutTest.java Tue May 3 07:18:19 2011 @@ -17,23 +17,21 @@ * under the License. */ - package org.apache.isis.viewer.dnd.viewer.view.configurable; import junit.framework.Assert; -import org.jmock.Expectations; -import org.jmock.integration.junit4.JUnit4Mockery; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext; import org.apache.isis.runtimes.dflt.runtime.testsystem.TestProxyConfiguration; import org.apache.isis.viewer.dnd.drawing.Location; import org.apache.isis.viewer.dnd.drawing.Size; import org.apache.isis.viewer.dnd.view.View; import org.apache.isis.viewer.dnd.view.composite.GridLayout; - +import org.jmock.Expectations; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; public class GridLayoutTest { private static final int CONTAINER_HEIGHT = 100; @@ -55,13 +53,14 @@ public class GridLayoutTest { @After public void complete() { - // mockery.assertIsSatisfied(); + // mockery.assertIsSatisfied(); } private void createContainer(final View[] views) { mockery.checking(new Expectations() { { - one(container).getSubviews(); will(returnValue(views)); + one(container).getSubviews(); + will(returnValue(views)); } }); } @@ -107,7 +106,7 @@ public class GridLayoutTest { final View view3 = createLayoutView(0, 10, 20, 10); final View view4 = createLayoutView(20, 10, 20, 10); final View view5 = createLayoutView(0, 20, 20, 10); - createContainer(new View[] { view1, view2, view3, view4, view5 }); + createContainer(new View[] { view1, view2, view3, view4, view5 }); layout.setOrientation(GridLayout.COLUMNS); layout.setSize(2); @@ -121,7 +120,7 @@ public class GridLayoutTest { final View view3 = createLayoutView(40, 0, 20, 10); final View view4 = createLayoutView(0, 10, 20, 10); final View view5 = createLayoutView(20, 10, 20, 10); - createContainer(new View[] { view1, view2, view3, view4, view5 }); + createContainer(new View[] { view1, view2, view3, view4, view5 }); layout.setOrientation(GridLayout.COLUMNS); layout.setSize(3); @@ -154,11 +153,7 @@ public class GridLayoutTest { layout.layout(container, new Size(CONTAINER_WIDTH, CONTAINER_HEIGHT)); } - private View createLayoutView( - final int x, - final int y, - final int width, - final int height) { + private View createLayoutView(final int x, final int y, final int width, final int height) { final View view = mockery.mock(View.class, "view" + viewIndex++); mockery.checking(new Expectations() { { @@ -184,7 +179,7 @@ public class GridLayoutTest { createContainer(new View[] { createView(20, 10), createView(30, 10) }); Assert.assertEquals(50, layout.getRequiredSize(container).getWidth()); } - + @Test public void widthMaxTwoViews() { createContainer(new View[] { createView(25, 10), createView(20, 10) }); @@ -198,7 +193,6 @@ public class GridLayoutTest { Assert.assertEquals(40, layout.getRequiredSize(container).getHeight()); } - @Test public void sizeOver2Columns() { final View view1 = createView(30, 10); @@ -237,4 +231,3 @@ public class GridLayoutTest { } } - Modified: incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/view/field/TextFieldBorderTest.java URL: http://svn.apache.org/viewvc/incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/view/field/TextFieldBorderTest.java?rev=1098945&r1=1098944&r2=1098945&view=diff ============================================================================== --- incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/view/field/TextFieldBorderTest.java (original) +++ incubator/isis/trunk/viewer/dnd/src/test/java/org/apache/isis/viewer/dnd/viewer/view/field/TextFieldBorderTest.java Tue May 3 07:18:19 2011 @@ -17,17 +17,15 @@ * under the License. */ - package org.apache.isis.viewer.dnd.viewer.view.field; import junit.framework.TestCase; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; import org.apache.isis.viewer.dnd.DummyView; import org.apache.isis.viewer.dnd.drawing.Padding; import org.apache.isis.viewer.dnd.field.TextFieldBorder; - +import org.apache.log4j.Level; +import org.apache.log4j.Logger; public class TextFieldBorderTest extends TestCase {