Revision: 1091
Author: jhoskens
Date: 2006-04-25 23:44:42 -0700 (Tue, 25 Apr 2006)
ViewCVS: http://svn.sourceforge.net/spring-rich-c/?rev=1091&view=rev
Log Message:
-----------
Added test on revert of parent triggering revert of child
Modified Paths:
--------------
trunk/spring-richclient/support/src/test/java/org/springframework/binding/form/support/AbstractFormModelTests.java
Modified:
trunk/spring-richclient/support/src/test/java/org/springframework/binding/form/support/AbstractFormModelTests.java
===================================================================
---
trunk/spring-richclient/support/src/test/java/org/springframework/binding/form/support/AbstractFormModelTests.java
2006-04-25 18:24:39 UTC (rev 1090)
+++
trunk/spring-richclient/support/src/test/java/org/springframework/binding/form/support/AbstractFormModelTests.java
2006-04-26 06:44:42 UTC (rev 1091)
@@ -140,6 +140,10 @@
assertEquals(6, pcl.eventCount());
}
+ /**
+ * Test on dirty state of parent-child relations. When child gets dirty,
parent should
+ * also be dirty. When parent reverts, child should revert too.
+ */
public void testDirtyTracksKids() {
TestPropertyChangeListener pcl = new
TestPropertyChangeListener(FormModel.DIRTY_PROPERTY);
AbstractFormModel pfm = getFormModel(new TestBean());
@@ -148,7 +152,7 @@
pfm.addChild(fm);
ValueModel childSimpleProperty = fm.getValueModel("simpleProperty");
ValueModel parentSimpleProperty = pfm.getValueModel("simpleProperty");
-
+ // test child property dirty -> parent dirty
childSimpleProperty.setValue("1");
assertTrue(pfm.isDirty());
assertEquals(1, pcl.eventCount());
@@ -156,22 +160,31 @@
fm.revert();
assertTrue(!pfm.isDirty());
assertEquals(2, pcl.eventCount());
-
+ // child dirty -> revert parent triggers revert on child
childSimpleProperty.setValue("1");
assertTrue(pfm.isDirty());
assertEquals(3, pcl.eventCount());
+
+ pfm.revert();
+ assertTrue(!pfm.isDirty());
+ assertTrue(!fm.isDirty());
+ assertEquals(4, pcl.eventCount());
+ // child & parent property dirty -> parent dirty, revert child, then
parent
+ childSimpleProperty.setValue("1");
+ assertTrue(pfm.isDirty());
+ assertEquals(5, pcl.eventCount());
parentSimpleProperty.setValue("2");
assertTrue(pfm.isDirty());
- assertEquals(3, pcl.eventCount());
+ assertEquals(5, pcl.eventCount());
fm.revert();
assertTrue(pfm.isDirty());
- assertEquals(3, pcl.eventCount());
+ assertEquals(5, pcl.eventCount());
pfm.revert();
assertTrue(!pfm.isDirty());
- assertEquals(4, pcl.eventCount());
+ assertEquals(6, pcl.eventCount());
}
public void testSetFormObjectDoesNotRevertChangesToPreviousFormObject() {
@@ -442,9 +455,7 @@
if (executer != null) {
return executer;
}
- else {
- throw new IllegalArgumentException("no converter found");
- }
+ throw new IllegalArgumentException("no converter found");
}
public ConversionExecutor getConversionExecutorByTargetAlias(Class
arg0, String arg1)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
spring-rich-c-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs