diff options
author | Pawel Piech | 2011-02-25 18:23:52 +0000 |
---|---|---|
committer | Pawel Piech | 2011-02-25 18:23:52 +0000 |
commit | 5c1cfbca9d99420e838f1a6f6efb6c141fcb393c (patch) | |
tree | 16262752d0b7ec6886ca363a385deea5ccc761db /org.eclipse.debug.tests | |
parent | 6cbc82066cadf920af5dad59d81f1cb7da3c1861 (diff) | |
download | eclipse.platform.debug-5c1cfbca9d99420e838f1a6f6efb6c141fcb393c.tar.gz eclipse.platform.debug-5c1cfbca9d99420e838f1a6f6efb6c141fcb393c.tar.xz eclipse.platform.debug-5c1cfbca9d99420e838f1a6f6efb6c141fcb393c.zip |
Bug 335193 - NullPointerException raised by ModelContentProvider.cancelRestore
Diffstat (limited to 'org.eclipse.debug.tests')
-rw-r--r-- | org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/LazyTests.java | 15 | ||||
-rw-r--r-- | org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java | 13 |
2 files changed, 21 insertions, 7 deletions
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 index 5928aa4c2..3aafd0362 100644 --- 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 @@ -158,7 +158,7 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis * then selected and replaced, that no extra elements are retrieved. * (bug 304277 comment #24, and bug 305739 comment #9). */ - public void _x_testReplaceAndSelectInSubTreeTree() { + public void testReplaceAndSelectInSubTreeTree() { // Create test model with lots of children. TestModel model = largeSubtreeModel(1000); @@ -169,9 +169,12 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis // 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); + fListener.reset();
+ fListener.setFailOnMultipleModelUpdateSequences(true);
+ fListener.setFailOnRedundantUpdates(false);
fViewer.setInput(model.getRootElement()); - while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE | LABEL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep (); + fListener.addLabelUpdate(model.findElement("1.0"));
+ while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE | LABEL_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")} )); @@ -196,7 +199,7 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis fListener.addLabelUpdate(_1_0_newElementPath); model.postDelta(rootDelta); - while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | LABEL_UPDATES_COMPLETE)) + while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | LABEL_COMPLETE))
if (!fDisplay.readAndDispatch ()) fDisplay.sleep (); @@ -224,7 +227,7 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis fListener.reset(); fListener.setFailOnRedundantUpdates(false); fViewer.reveal(model.findElement("1"), 500); - while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE | LABEL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep (); + while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) fDisplay.sleep ();
// Create delta to refresh the "1" element. TestElement rootElement = model.getRootElement(); @@ -254,7 +257,7 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis } model.postDelta(rootDelta); - while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE | LABEL_UPDATES_COMPLETE)) + while (!fListener.isFinished(CONTENT_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
if (!fDisplay.readAndDispatch ()) fDisplay.sleep (); } } 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 500d1038c..ebe686801 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 @@ -51,7 +51,9 @@ public class TestModelUpdatesListener private IStatus fJobError; private boolean fFailOnRedundantUpdates; + private boolean fFailOnRedundantLabelUpdates; private Set fRedundantUpdates = new HashSet(); + private Set fRedundantLabelUpdates = new HashSet(); private Set fRedundantHasChildrenUpdateExceptions = new HashSet(); private Set fRedundantChildCountUpdateExceptions = new HashSet(); private Set fRedundantChildrenUpdateExceptions = new HashSet(); @@ -130,6 +132,10 @@ public class TestModelUpdatesListener fFailOnRedundantUpdates = failOnRedundantUpdates; } + public void setFailOnRedundantLabelUpdates(boolean failOnRedundantLabelUpdates) {
+ fFailOnRedundantLabelUpdates = failOnRedundantLabelUpdates;
+ }
+
public void setFailOnMultipleModelUpdateSequences(boolean failOnMultipleLabelUpdateSequences) { fFailOnMultipleModelUpdateSequences = failOnMultipleLabelUpdateSequences; } @@ -165,6 +171,7 @@ public class TestModelUpdatesListener public void reset() { fJobError = null; fRedundantUpdates.clear(); + fRedundantLabelUpdates.clear();
fRedundantHasChildrenUpdateExceptions.clear(); fRedundantChildCountUpdateExceptions.clear(); fRedundantChildrenUpdateExceptions.clear(); @@ -368,6 +375,9 @@ public class TestModelUpdatesListener if (fFailOnRedundantUpdates && !fRedundantUpdates.isEmpty()) { Assert.fail("Redundant Updates: " + fRedundantUpdates.toString()); } + if (fFailOnRedundantLabelUpdates && !fRedundantLabelUpdates.isEmpty()) {
+ Assert.fail("Redundant Label Updates: " + fRedundantLabelUpdates.toString());
+ }
if (fFailOnMultipleLabelUpdateSequences && !fMultipleLabelUpdateSequencesObserved) { Assert.fail("Multiple label update sequences detected"); } @@ -524,9 +534,10 @@ public class TestModelUpdatesListener fLabelUpdatesCounter--; } if (!fLabelUpdates.remove(update.getElementPath()) && - fFailOnRedundantUpdates && + fFailOnRedundantLabelUpdates &&
!fRedundantLabelUpdateExceptions.contains(update.getElementPath())) { + fRedundantLabelUpdates.add(update);
Assert.fail("Redundant update: " + update); } } |