The following unit test passes but I'm pretty sure it shouldn't. Can
someone explain to me the rationale behind this?

This particular test is for the SWT module, but looking at the code in
the core for handles, it's the same there.

Shouldn't the locator change to match the handle's new parent? Maybe
not in the general case, but when the parent and the node pointed to
in the locator are the same, shouldn't it then?

public void testChangingParentDoesNotChangeLocatorNode() {
        if (hasHead()) {
            PNode node = new PNode();
            PLocator locator = PBoundsLocator.createEastLocator(node);
            PSWTHandle handle = new PSWTHandle(locator);
            node.addChild(handle);
            node.setBounds(0, 0, 100, 100);
            handle.relocateHandle();

            PNode newParent = new PNode();
            newParent.setBounds(50, 50, 100, 100);

            final double originalX = handle.getX();
            handle.setParent(newParent);

            final double newX = handle.getX();

            assertEquals(newX, originalX, Double.MIN_VALUE);
        }
    }
--~--~---------~--~----~------------~-------~--~----~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to