|
Added
Link Here
|
| 1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2006 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
| 8 |
* Contributors: |
| 9 |
* IBM Corporation - initial API and implementation |
| 10 |
*******************************************************************************/ |
| 11 |
|
| 12 |
package org.eclipse.draw2d.test; |
| 13 |
|
| 14 |
import junit.framework.TestCase; |
| 15 |
|
| 16 |
import org.eclipse.draw2d.Figure; |
| 17 |
import org.eclipse.draw2d.FigureUtilities; |
| 18 |
import org.eclipse.draw2d.IFigure; |
| 19 |
|
| 20 |
|
| 21 |
public class FigureUtilitiesTest extends TestCase { |
| 22 |
/** |
| 23 |
* @see TestCase#setUp() |
| 24 |
*/ |
| 25 |
protected void setUp() throws Exception { |
| 26 |
super.setUp(); |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* @see TestCase#tearDown() |
| 31 |
*/ |
| 32 |
protected void tearDown() throws Exception { |
| 33 |
super.tearDown(); |
| 34 |
} |
| 35 |
|
| 36 |
public void test_findCommonAncestor_happypath() { |
| 37 |
IFigure figureParent = new Figure(); |
| 38 |
IFigure figureChild1 = new Figure(); |
| 39 |
IFigure figureChild2 = new Figure(); |
| 40 |
IFigure figureChild3 = new Figure(); |
| 41 |
|
| 42 |
figureParent.add(figureChild1); |
| 43 |
figureChild1.add(figureChild2); |
| 44 |
figureParent.add(figureChild3); |
| 45 |
|
| 46 |
IFigure result = FigureUtilities.findCommonAncestor(figureChild2, figureChild3); |
| 47 |
assertTrue(figureParent == result); |
| 48 |
} |
| 49 |
|
| 50 |
public void test_findCommonAncestor_bugzilla130042() { |
| 51 |
IFigure figureParent = new Figure(); |
| 52 |
IFigure figureChild = new Figure(); |
| 53 |
figureParent.add(figureChild); |
| 54 |
|
| 55 |
IFigure result = FigureUtilities.findCommonAncestor(figureParent, figureChild); |
| 56 |
assertTrue(figureParent == result); |
| 57 |
} |
| 58 |
} |