Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 39308 Details for
Bug 138192
FigureUtilities.findCommonAncestor throws exception when one edit part contains another
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch for defect
138192.txt (text/plain), 4.15 KB, created by
Steven R. Shaw
on 2006-04-24 14:00:33 EDT
(
hide
)
Description:
patch for defect
Filename:
MIME Type:
Creator:
Steven R. Shaw
Created:
2006-04-24 14:00:33 EDT
Size:
4.15 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.draw2d.test >Index: src/org/eclipse/draw2d/test/Draw2dTestSuite.java >=================================================================== >RCS file: /home/tools/org.eclipse.draw2d.test/src/org/eclipse/draw2d/test/Draw2dTestSuite.java,v >retrieving revision 1.16 >diff -u -r1.16 Draw2dTestSuite.java >--- src/org/eclipse/draw2d/test/Draw2dTestSuite.java 21 Apr 2006 20:06:13 -0000 1.16 >+++ src/org/eclipse/draw2d/test/Draw2dTestSuite.java 24 Apr 2006 17:47:48 -0000 >@@ -44,6 +44,7 @@ > addTest(new TestSuite(PointListTests.class)); > addTest(new TestSuite(PrecisionRectangleTest.class)); > addTest(new TestSuite(ThumbnailTest.class)); >+ addTest(new TestSuite(FigureUtilitiesTest.class)); > // addTest(new TestSuite(ColorConstantTest.class)); > } > >Index: src/org/eclipse/draw2d/test/FigureUtilitiesTest.java >=================================================================== >RCS file: src/org/eclipse/draw2d/test/FigureUtilitiesTest.java >diff -N src/org/eclipse/draw2d/test/FigureUtilitiesTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/draw2d/test/FigureUtilitiesTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,58 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.draw2d.test; >+ >+import junit.framework.TestCase; >+ >+import org.eclipse.draw2d.Figure; >+import org.eclipse.draw2d.FigureUtilities; >+import org.eclipse.draw2d.IFigure; >+ >+ >+public class FigureUtilitiesTest extends TestCase { >+ /** >+ * @see TestCase#setUp() >+ */ >+ protected void setUp() throws Exception { >+ super.setUp(); >+ } >+ >+ /** >+ * @see TestCase#tearDown() >+ */ >+ protected void tearDown() throws Exception { >+ super.tearDown(); >+ } >+ >+ public void test_findCommonAncestor_happypath() { >+ IFigure figureParent = new Figure(); >+ IFigure figureChild1 = new Figure(); >+ IFigure figureChild2 = new Figure(); >+ IFigure figureChild3 = new Figure(); >+ >+ figureParent.add(figureChild1); >+ figureChild1.add(figureChild2); >+ figureParent.add(figureChild3); >+ >+ IFigure result = FigureUtilities.findCommonAncestor(figureChild2, figureChild3); >+ assertTrue(figureParent == result); >+ } >+ >+ public void test_findCommonAncestor_bugzilla130042() { >+ IFigure figureParent = new Figure(); >+ IFigure figureChild = new Figure(); >+ figureParent.add(figureChild); >+ >+ IFigure result = FigureUtilities.findCommonAncestor(figureParent, figureChild); >+ assertTrue(figureParent == result); >+ } >+} >#P org.eclipse.draw2d >Index: src/org/eclipse/draw2d/FigureUtilities.java >=================================================================== >RCS file: /home/tools/org.eclipse.draw2d/src/org/eclipse/draw2d/FigureUtilities.java,v >retrieving revision 1.33 >diff -u -r1.33 FigureUtilities.java >--- src/org/eclipse/draw2d/FigureUtilities.java 30 Nov 2005 16:25:55 -0000 1.33 >+++ src/org/eclipse/draw2d/FigureUtilities.java 24 Apr 2006 17:47:51 -0000 >@@ -398,16 +398,17 @@ > } > if (left.isEmpty() || right.isEmpty()) > return null; >- int il = left.size() - 1; >- int ir = right.size() - 1; >- while (left.get(il) == right.get(ir)) { >- il--; >- ir--; >- } >- ++il; >- if (il < left.size()) >- return (IFigure)left.get(il); >- return null; >+ >+ int il = left.size() - 1; >+ int ir = right.size() - 1; >+ do { >+ if (left.get(il) != right.get(ir)) >+ break; >+ il--; >+ ir--; >+ } while (il >= 0 && ir >= 0); >+ >+ return (IFigure) left.get(il + 1); > } > > /**
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 138192
: 39308