Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2010-09-29 17:46:47 +0000
committerPawel Piech2010-09-29 17:46:47 +0000
commit712721b44ce81a6cf97978ebf593762e53af266a (patch)
treebb731275d6b72454dc96cae65314568a6334c585 /org.eclipse.debug.tests
parent250b57deca7503f0d9d2f72d35ff2abaa14230e4 (diff)
downloadeclipse.platform.debug-712721b44ce81a6cf97978ebf593762e53af266a.tar.gz
eclipse.platform.debug-712721b44ce81a6cf97978ebf593762e53af266a.tar.xz
eclipse.platform.debug-712721b44ce81a6cf97978ebf593762e53af266a.zip
Bug 326565 - [Flex hierarchy] Unit tests for lazy loading in debugger views
Diffstat (limited to 'org.eclipse.debug.tests')
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java103
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerLazyTests.java32
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/LazyTests.java200
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PopupTests.java2
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java9
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModel.java8
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java2
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java2
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/AutomatedSuite.java2
9 files changed, 349 insertions, 11 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java
index 9e9662f2b..6ad2b6027 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java
@@ -337,7 +337,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Update the model
TestElement element = new TestElement(model, "7", new TestElement[0]);
TreePath elementPath = new TreePath(new Object[] { element });
- ModelDelta delta = model.addElementChild(TreePath.EMPTY, 6, element);
+ ModelDelta delta = model.addElementChild(TreePath.EMPTY, null, 6, element);
// Add causes the update of parent child count and element's children.
fListener.reset(elementPath, element, -1, true, false);
@@ -350,6 +350,105 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
model.validateData(fViewer, TreePath.EMPTY);
}
+ public void testAddUnexpandedElement() {
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+
+ TestModel model = TestModel.simpleMultiLevel();
+
+ // Turn off auto-expansion
+ fViewer.setAutoExpandLevel(0);
+
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+
+ // Update the model
+ TreePath parentPath = model.findElement("1");
+ ModelDelta rootDelta = model.addElementChild(parentPath, null, 0, new TestElement(model, "1.1", new TestElement[0]));
+ model.addElementChild(parentPath, rootDelta, 1, new TestElement(model, "1.2", new TestElement[0]));
+ model.addElementChild(parentPath, rootDelta, 2, new TestElement(model, "1.3", new TestElement[0]));
+ model.addElementChild(parentPath, rootDelta, 3, new TestElement(model, "1.4", new TestElement[0]));
+
+ // Add causes the update of parent child count and element's children.
+ fListener.reset();
+ fListener.setFailOnRedundantUpdates(false);
+ model.postDelta(rootDelta);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_UPDATES_COMPLETE))
+ if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+
+ // Update the elements that were added.
+ fListener.reset();
+ fListener.addUpdates((ITreeModelContentProviderTarget)fViewer, TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
+ rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.CONTENT);
+ model.getElementDelta(rootDelta, model.findElement("1.1"), true).setFlags(IModelDelta.CONTENT);
+ model.getElementDelta(rootDelta, model.findElement("1.2"), true).setFlags(IModelDelta.CONTENT);
+ model.getElementDelta(rootDelta, model.findElement("1.3"), true).setFlags(IModelDelta.CONTENT);
+ model.getElementDelta(rootDelta, model.findElement("1.4"), true).setFlags(IModelDelta.CONTENT);
+
+ model.postDelta(rootDelta);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | ALL_UPDATES_COMPLETE))
+ if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+
+ fListener.reset(parentPath, model.getElement(parentPath), 1, false, true);
+ ((ITreeModelContentProviderTarget)fViewer).expandToLevel(parentPath, 1);
+
+ while (fListener.isFinished(CONTENT_UPDATES_STARTED) && !fListener.isFinished(CONTENT_UPDATES_COMPLETE))
+ if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+
+ model.validateData(fViewer, parentPath);
+ }
+
+ public void _x_testRefreshUnexpandedElementsChildren() {
+ //TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
+
+ TestModel model = TestModel.simpleMultiLevel();
+
+ // Turn off auto-expansion
+ fViewer.setAutoExpandLevel(0);
+
+ // Create the listener
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+
+ // Set the input into the view and update the view.
+ fViewer.setInput(model.getRootElement());
+ while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+
+ // Expand elment "2"
+ TreePath parentPath = model.findElement("2");
+ fListener.reset(parentPath, model.getElement(parentPath), 1, false, true);
+ ((ITreeModelContentProviderTarget)fViewer).expandToLevel(parentPath, 1);
+
+ while (fListener.isFinished(CONTENT_UPDATES_STARTED) && !fListener.isFinished(CONTENT_UPDATES_COMPLETE))
+ if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+
+ // Collapse back element "2"
+ ((ITreeModelContentProviderTarget)fViewer).setExpandedState(parentPath, false);
+
+ // Update the children of element "2".
+ fListener.reset();
+ fListener.addUpdates((ITreeModelContentProviderTarget)fViewer, TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
+ ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.CONTENT);
+ model.getElementDelta(rootDelta, model.findElement("2.1"), true).setFlags(IModelDelta.CONTENT);
+ model.getElementDelta(rootDelta, model.findElement("2.2"), true).setFlags(IModelDelta.CONTENT);
+ model.getElementDelta(rootDelta, model.findElement("2.3"), true).setFlags(IModelDelta.CONTENT);
+
+ model.postDelta(rootDelta);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | ALL_UPDATES_COMPLETE))
+ if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+
+ // Expand back element "2"
+ fListener.reset(parentPath, model.getElement(parentPath), 1, false, true);
+ ((ITreeModelContentProviderTarget)fViewer).expandToLevel(parentPath, 1);
+
+ while (fListener.isFinished(CONTENT_UPDATES_STARTED) && !fListener.isFinished(CONTENT_UPDATES_COMPLETE))
+ if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+
+ model.validateData(fViewer, parentPath, true);
+ }
+
public void testRemove() {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
@@ -565,7 +664,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
TestModel m3 = m3_1.getModel();
TestElement m3_1_new = new TestElement(m3, "m3.1-new", new TestElement[0]);
TreePath m3_1_newPath = m3_1Path.createChildPath(m3_1_new);
- ModelDelta delta = m3.addElementChild(m3_1Path, 0, m3_1_new);
+ ModelDelta delta = m3.addElementChild(m3_1Path, null, 0, m3_1_new);
fListener.reset(m3_1_newPath, m3_1_new, -1, true, false);
fListener.addChildreUpdate(m3_1Path, 0);
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerLazyTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerLazyTests.java
new file mode 100644
index 000000000..42028b0b7
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerLazyTests.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Wind River Systems 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipe.debug.tests.viewer.model;
+
+import org.eclipse.debug.internal.ui.viewers.model.ITreeModelContentProviderTarget;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * @since 3.6
+ */
+public class JFaceViewerLazyTests extends LazyTests {
+
+ public JFaceViewerLazyTests(String name) {
+ super(name);
+ }
+
+ protected ITreeModelContentProviderTarget createViewer(Display display, Shell shell) {
+ return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer"));
+ }
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/LazyTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/LazyTests.java
new file mode 100644
index 000000000..7c0ac8e2b
--- /dev/null
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/LazyTests.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Wind River Systems 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:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipe.debug.tests.viewer.model;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.eclipe.debug.tests.viewer.model.TestModel.TestElement;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.debug.internal.ui.viewers.model.ITreeModelContentProviderTarget;
+import org.eclipse.debug.internal.ui.viewers.model.ITreeModelViewer;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * Tests that verify that the viewer property retrieves all the content
+ * from the model.
+ *
+ * @since 3.6
+ */
+abstract public class LazyTests extends TestCase implements ITestModelUpdatesListenerConstants {
+
+ Display fDisplay;
+ Shell fShell;
+ ITreeModelViewer fViewer;
+ TestModelUpdatesListener fListener;
+
+ public LazyTests(String name) {
+ super(name);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void setUp() throws Exception {
+ fDisplay = PlatformUI.getWorkbench().getDisplay();
+ fShell = new Shell(fDisplay/*, SWT.ON_TOP | SWT.SHELL_TRIM*/);
+ fShell.setMaximized(true);
+ fShell.setLayout(new FillLayout());
+
+ fViewer = createViewer(fDisplay, fShell);
+
+ fListener = new TestModelUpdatesListener(fViewer, true, true);
+
+ fShell.open ();
+ }
+
+ abstract protected ITreeModelContentProviderTarget createViewer(Display display, Shell shell);
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void tearDown() throws Exception {
+ fListener.dispose();
+ fViewer.getPresentationContext().dispose();
+
+ // Close the shell and exit.
+ fShell.close();
+ while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ }
+
+ protected void runTest() throws Throwable {
+ try {
+ super.runTest();
+ } catch (Throwable t) {
+ throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t);
+ }
+ }
+
+ /**
+ * Creates a model in the pattern of:
+ *
+ * root
+ * 1
+ * 1.1
+ * 1.2
+ * 1.3
+ * ...
+ * 1.(size)
+ */
+ private TestModel largeSubtreeModel(int size) {
+ TestModel model = new TestModel();
+ TestElement[] children = new TestElement[size];
+ for (int i = 0; i < size; i++) {
+ children[i] = new TestElement(model, "1." + i, new TestElement[0]);
+ }
+ TestElement element = new TestElement(model, "1", children);
+ model.setRoot(new TestElement(model, "root", new TestElement[] { element }));
+
+ return model;
+ }
+
+ /**
+ * Test to make sure that if an element is expanded its children are
+ * not automatically materialized.
+ * (bug 305739 and bug 304277)
+ */
+ public void testExpandLargeSubTree() {
+ // Create test model with lots of children.
+ TestModel model = largeSubtreeModel(1000);
+
+ // NOTE: WE ARE NOT EXPANDING ANY CHILDREN
+
+ // Populate initial view content
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, true);
+ fViewer.setInput(model.getRootElement());
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+
+ // Create delta to expand the "1" element.
+ TestElement rootElement = model.getRootElement();
+ ModelDelta rootDelta = new ModelDelta(rootElement, IModelDelta.NO_CHANGE);
+ ModelDelta expandDelta = model.getBaseDelta(rootDelta);
+ TestElement expandElement = rootElement.getChildren()[0];
+ expandDelta.addNode(expandElement, 0, IModelDelta.EXPAND, expandElement.getChildren().length);
+
+ // Add first 250 elements as acceptable to materialize
+ fListener.reset();
+ fListener.setFailOnRedundantUpdates(true);
+ TreePath expandElementPath = model.findElement("1");
+ fListener.addChildreCountUpdate(expandElementPath);
+ fListener.addLabelUpdate(expandElementPath); // TODO: not sure why label is updated upon expand?
+ for (int i = 0; i < 250; i++) {
+ fListener.addChildreUpdate(expandElementPath, i);
+ TreePath childPath = expandElementPath.createChildPath(expandElement.getChildren()[i]);
+ fListener.addLabelUpdate(childPath);
+ fListener.addHasChildrenUpdate(childPath);
+ }
+ model.postDelta(rootDelta);
+
+ while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE | LABEL_UPDATES_COMPLETE))
+ if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+ }
+
+ /**
+ * Test to make sure that if an element that is previously selected, is
+ * then selected and replaced, that no extra elements are retrieved.
+ * (bug 304277 comment #24, and bug 305739 comment #9).
+ */
+ public void testReplaceAndSelectInSubTreeTree() {
+ // Create test model with lots of children.
+ TestModel model = largeSubtreeModel(1000);
+
+ // Expand all children
+ fViewer.setAutoExpandLevel(-1);
+
+ // Populate initial view content, watch for all updates but only wait
+ // for the content update sequence to finish (elements off screen will
+ // not be updated).
+ // TODO: child count for element 1 is updated multiple times.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, true);
+ fViewer.setInput(model.getRootElement());
+ while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE | LABEL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+
+ // Set selection so that the initial selection is not empty
+ fViewer.setSelection(new TreeSelection(new TreePath[] { model.findElement("1.0")} ));
+
+ // Create delta to select the "1" element.
+ TestElement rootElement = model.getRootElement();
+ ModelDelta rootDelta = new ModelDelta(rootElement, IModelDelta.NO_CHANGE);
+ ModelDelta baseDelta = model.getBaseDelta(rootDelta);
+ TestElement _1Element = rootElement.getChildren()[0];
+ ModelDelta _1Delta = baseDelta.addNode(_1Element, 0, IModelDelta.NO_CHANGE, _1Element.getChildren().length);
+
+ // Add the delta to select the "1.1" element.
+ TestElement _1_0_newElement = new TestElement(model, "1.0 - new", new TestElement[0]);
+ TreePath _1ElementPath = model.findElement("1");
+ model.replaceElementChild(_1ElementPath, 0, _1_0_newElement);
+ _1Delta.addNode(_1_0_newElement, 0, IModelDelta.SELECT);
+
+ // Add element label update and post the delta
+ fListener.reset();
+ fListener.setFailOnRedundantUpdates(true);
+ TreePath _1_0_newElementPath = model.findElement("1.0 - new");
+ fListener.addLabelUpdate(_1_0_newElementPath);
+ model.postDelta(rootDelta);
+
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | LABEL_UPDATES_COMPLETE))
+ if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
+
+
+ Assert.assertEquals(((IStructuredSelection)fViewer.getSelection()).getFirstElement(), _1_0_newElement);
+ }
+
+
+}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PopupTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PopupTests.java
index 38848d05a..f2c8b8949 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PopupTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PopupTests.java
@@ -203,7 +203,7 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
fViewer.setSelection(originalSelection);
// Update the model
- model.addElementChild(model.findElement("3"), 0, new TestElement(model, "3.0 - new", new TestElement[0]));
+ model.addElementChild(model.findElement("3"), null, 0, new TestElement(model, "3.0 - new", new TestElement[0]));
// Create the delta for element "3" with content update.
TreePath elementPath = model.findElement("3");
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java
index f1c79cb2f..62cd5b9e3 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java
@@ -184,6 +184,9 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
* 3.1
* 3.1.1
* ...
+ * (size)
+ * (size).1
+ * (size).1.1
*/
private TestModel alternatingSubsreesModel(int size) {
TestModel model = new TestModel();
@@ -410,7 +413,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fViewer.setSelection(originalSelection);
// Update the model
- model.addElementChild(model.findElement("3"), 0, new TestElement(model, "3.0 - new", new TestElement[0]));
+ model.addElementChild(model.findElement("3"), null, 0, new TestElement(model, "3.0 - new", new TestElement[0]));
// Create the delta for element "3" with content update.
TreePath elementPath = model.findElement("3");
@@ -486,7 +489,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
Assert.assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
// Update the model again
- model.addElementChild(TreePath.EMPTY, 0, new TestElement(model, "1", new TestElement[0]));
+ model.addElementChild(TreePath.EMPTY, null, 0, new TestElement(model, "1", new TestElement[0]));
// Note: Re-expanding nodes causes redundant updates.
fListener.reset(false, false);
@@ -548,7 +551,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
Assert.assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
// Update the model again
- model.addElementChild(TreePath.EMPTY, 0, new TestElement(model, "1", new TestElement[0]));
+ model.addElementChild(TreePath.EMPTY, null, 0, new TestElement(model, "1", new TestElement[0]));
// Note: Re-expanding nodes causes redundant updates.
fListener.reset(false, false);
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModel.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModel.java
index 042650a59..8a3287849 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModel.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModel.java
@@ -455,14 +455,16 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
return rootDelta;
}
- public ModelDelta addElementChild(TreePath parentPath, int index, TestElement newChild) {
- ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+ public ModelDelta addElementChild(TreePath parentPath, ModelDelta rootDelta, int index, TestElement newChild) {
+ if (rootDelta == null) {
+ rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
+ }
ModelDelta baseDelta = getBaseDelta(rootDelta);
TreePath relativePath = getRelativePath(parentPath);
// Find the parent element and generate the delta node for it.
TestElement element = getElement(relativePath);
- ModelDelta delta= getElementDelta(baseDelta, relativePath, false);
+ ModelDelta delta= getElementDelta(baseDelta, relativePath, true);
// Add the new element
element.fChildren = doInsertElementInArray(element.fChildren, index, newChild);
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java
index a96c991ac..4a0063ce6 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java
@@ -369,7 +369,7 @@ public class TestModelUpdatesListener
} if (update instanceof IChildrenCountUpdate) {
fChildCountUpdatesRunning.add(update);
} else if (update instanceof IChildrenUpdate) {
- fChildCountUpdatesRunning.add(update);
+ fChildrenUpdatesRunning.add(update);
}
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java
index 2380ce8f9..4e658cfb9 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java
@@ -173,7 +173,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
private void addElement(TestModel model, String label, int position, boolean validate) {
- ModelDelta delta = model.addElementChild(TreePath.EMPTY, position, new TestElement(model, label, new TestElement[0]));
+ ModelDelta delta = model.addElementChild(TreePath.EMPTY, null, position, new TestElement(model, label, new TestElement[0]));
// Remove delta should generate no new updates, but we still need to wait for the event to
// be processed.
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/AutomatedSuite.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/AutomatedSuite.java
index 2e33dc384..6262b9f47 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/AutomatedSuite.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/AutomatedSuite.java
@@ -25,6 +25,7 @@ import org.eclipe.debug.tests.viewer.model.FilterTransformTests;
import org.eclipe.debug.tests.viewer.model.JFaceViewerCheckTests;
import org.eclipe.debug.tests.viewer.model.JFaceViewerContentTests;
import org.eclipe.debug.tests.viewer.model.JFaceViewerDeltaTests;
+import org.eclipe.debug.tests.viewer.model.JFaceViewerLazyTests;
import org.eclipe.debug.tests.viewer.model.JFaceViewerSelectionTests;
import org.eclipe.debug.tests.viewer.model.JFaceViewerStateTests;
import org.eclipe.debug.tests.viewer.model.JFaceViewerTopIndexTests;
@@ -65,6 +66,7 @@ public class AutomatedSuite extends TestSuite {
addTest(new TestSuite(JFaceViewerSelectionTests.class));
addTest(new TestSuite(JFaceViewerStateTests.class));
addTest(new TestSuite(JFaceViewerUpdateTests.class));
+ addTest(new TestSuite(JFaceViewerLazyTests.class));
addTest(new TestSuite(JFaceViewerTopIndexTests.class));
// Virtual viewer tests

Back to the top