Revision: 3577
Author: [email protected]
Date: Mon May 31 15:15:37 2010
Log: NEW - bug 2835: Dragging a PK column to the FK table causes an IOOBE
http://trillian.sqlpower.ca/bugzilla/show_bug.cgi?id=2835

Fixed an old off-by-one error. If there are three children (indexed at 0, 1, and 2) and the insertion point is at position 2 we are looking to insert an object after child at index 1. Removing child at index 2 should not affect the insertion point
as it comes just after the point we are looking at.
http://code.google.com/p/power-architect/source/detail?r=3577

Modified:
 /trunk/regress/ca/sqlpower/architect/InsertionPointWatcherTest.java
 /trunk/src/main/java/ca/sqlpower/architect/InsertionPointWatcher.java

=======================================
--- /trunk/regress/ca/sqlpower/architect/InsertionPointWatcherTest.java Mon Dec 21 08:27:43 2009 +++ /trunk/regress/ca/sqlpower/architect/InsertionPointWatcherTest.java Mon May 31 15:15:37 2010
@@ -72,7 +72,7 @@
InsertionPointWatcher<StubSQLObject> watcher = new InsertionPointWatcher<StubSQLObject>(so, 2, StubSQLObject.class);

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

     public void testRemoveAfterInsertionPoint() throws Exception {
=======================================
--- /trunk/src/main/java/ca/sqlpower/architect/InsertionPointWatcher.java Wed Mar 17 14:29:59 2010 +++ /trunk/src/main/java/ca/sqlpower/architect/InsertionPointWatcher.java Mon May 31 15:15:37 2010
@@ -85,7 +85,7 @@

         @Override
         public void childRemovedImpl(SPChildEvent e) {
- if (e.getChildType() == childType && e.getIndex() <= insertionPoint) { + if (e.getChildType() == childType && e.getIndex() < insertionPoint) {
                 insertionPoint--;
             }
         }

Reply via email to