[Tapestry-commits] CVS: Tapestry/junit/src/net/sf/tapestry/junit ComponentTest.java,NONE,1.1.2.1 Tap
Brought to you by:
hship
|
From: Howard L. S. <hs...@us...> - 2002-11-30 03:33:52
|
Update of /cvsroot/tapestry/Tapestry/junit/src/net/sf/tapestry/junit
In directory sc8-pr-cvs1:/tmp/cvs-serv15444/junit/src/net/sf/tapestry/junit
Modified Files:
Tag: hship-2-3
TapestrySuite.java
Added Files:
Tag: hship-2-3
ComponentTest.java
Log Message:
Add support for providing expressions in component templates.
--- NEW FILE: ComponentTest.java ---
package net.sf.tapestry.junit;
import net.sf.tapestry.BaseComponent;
import net.sf.tapestry.IMarkupWriter;
import net.sf.tapestry.IRender;
import net.sf.tapestry.IRequestCycle;
import net.sf.tapestry.RequestCycleException;
import net.sf.tapestry.engine.NullWriter;
/**
* Test a few random things in {@link net.sf.tapestry.AbstractComponent}
* and {@link net.sf.tapestry.BaseComponent}.
*
* @author Howard Lewis Ship
* @version $Id: ComponentTest.java,v 1.1.2.1 2002/11/30 03:33:19 hship Exp $
* @since NEXT_RELEASE
*
**/
public class ComponentTest extends TapestryTestCase
{
private static class TestRender implements IRender
{
private boolean rendered = false;
public void render(IMarkupWriter writer, IRequestCycle cycle) throws RequestCycleException
{
rendered = true;
}
}
private static class TestComponent extends BaseComponent
{
void addOuterTest(IRender render)
{
addOuter(render);
}
void testRenderComponent(IMarkupWriter write, IRequestCycle cycle)
throws RequestCycleException
{
renderComponent(write, cycle);
}
}
public ComponentTest(String name)
{
super(name);
}
/**
* Test the ability of {@link net.sf.tapestry.BaseComponent#addOuter(IRender)}
* to add a large number of objects.
*
**/
public void testOuter() throws Exception
{
TestComponent c = new TestComponent();
TestRender[] list = new TestRender[50];
for (int i = 0; i < list.length; i++)
{
list[i] = new TestRender();
c.addOuterTest(list[i]);
}
IMarkupWriter writer = new NullWriter();
c.testRenderComponent(writer, null);
for (int i = 0; i < list.length; i++)
assertTrue("Outer object #" + i + " did render.", list[i].rendered);
}
}
Index: TapestrySuite.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/junit/src/net/sf/tapestry/junit/TapestrySuite.java,v
retrieving revision 1.17
retrieving revision 1.17.2.1
diff -C2 -d -r1.17 -r1.17.2.1
*** TapestrySuite.java 27 Nov 2002 17:58:43 -0000 1.17
--- TapestrySuite.java 30 Nov 2002 03:33:19 -0000 1.17.2.1
***************
*** 43,46 ****
--- 43,47 ----
suite.addTestSuite(BindingsTestCase.class);
suite.addTestSuite(TestPropertySource.class);
+ suite.addTestSuite(ComponentTest.class);
suite.addTestSuite(MockTestCase.class);
|