Bug 507982 - split(SUPPRESS_ISCANCELED) should not check cancellation
Change-Id: I36399471731bafc5433b8d445ecef7e43260d612
Signed-off-by: Stefan Xenos <sxenos@gmail.com>
diff --git a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubMonitorTest.java b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubMonitorTest.java
index 7c02f92..400a440 100644
--- a/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubMonitorTest.java
+++ b/tests/org.eclipse.core.tests.runtime/src/org/eclipse/core/tests/runtime/SubMonitorTest.java
@@ -903,6 +903,23 @@
}
/**
+ * Verifies that no cancellation checks are performed within
+ * {@link SubMonitor#split(int, int)} when passing in the
+ * {@link SubMonitor#SUPPRESS_ISCANCELED} flag.
+ */
+ public void testSplitDoesNotCancelWhenCancellationSuppressed() {
+ TestProgressMonitor monitor = new TestProgressMonitor();
+ monitor.setCanceled(true);
+ SubMonitor progress = SubMonitor.convert(monitor, 100);
+ for (int idx = 0; idx < 100; idx++) {
+ progress.split(1, SubMonitor.SUPPRESS_ISCANCELED);
+ }
+
+ // If we get this far, it means cancellation was suppressed and the test
+ // passed
+ }
+
+ /**
* Creates and destroys the given number of child progress monitors under the given parent.
*
* @param parent monitor to create children under. The caller must call done on this monitor