Revision: 3205
Author: [email protected]
Date: Mon Dec 14 13:38:48 2009
Log: The insertion point watcher was adding to its insertion point when it was supposed to be subtracting on removal of children. Tests also needed to define the type of object that was being listened to for the watcher to update itself correctly.
http://code.google.com/p/power-architect/source/detail?r=3205

Modified:
/branches/sqlobject-spobject-model/regress/ca/sqlpower/architect/InsertionPointWatcherTest.java /branches/sqlobject-spobject-model/src/ca/sqlpower/architect/InsertionPointWatcher.java

=======================================
--- /branches/sqlobject-spobject-model/regress/ca/sqlpower/architect/InsertionPointWatcherTest.java Tue Dec 1 14:21:17 2009 +++ /branches/sqlobject-spobject-model/regress/ca/sqlpower/architect/InsertionPointWatcherTest.java Mon Dec 14 13:38:48 2009
@@ -62,14 +62,14 @@
     }

     public void testRemoveBeforeInsertionPoint() throws Exception {
- InsertionPointWatcher<StubSQLObject> watcher = new InsertionPointWatcher<StubSQLObject>(so, 2); + InsertionPointWatcher<StubSQLObject> watcher = new InsertionPointWatcher<StubSQLObject>(so, 2, StubSQLObject.class);

         so.removeChild(so.getChild(1));
         assertEquals(1, watcher.getInsertionPoint());
     }

     public void testRemoveAtInsertionPoint() throws Exception {
- InsertionPointWatcher<StubSQLObject> watcher = new InsertionPointWatcher<StubSQLObject>(so, 2); + InsertionPointWatcher<StubSQLObject> watcher = new InsertionPointWatcher<StubSQLObject>(so, 2, StubSQLObject.class);

         so.removeChild(so.getChild(2));
         assertEquals(1, watcher.getInsertionPoint());
=======================================
--- /branches/sqlobject-spobject-model/src/ca/sqlpower/architect/InsertionPointWatcher.java Tue Dec 1 15:08:53 2009 +++ /branches/sqlobject-spobject-model/src/ca/sqlpower/architect/InsertionPointWatcher.java Mon Dec 14 13:38:48 2009
@@ -86,7 +86,7 @@
         @Override
         public void childRemovedImpl(SPChildEvent e) {
if (e.getChildType() == childType && e.getIndex() <= insertionPoint) {
-                insertionPoint++;
+                insertionPoint--;
             }
         }

Reply via email to