|
1 | 1 | /*******************************************************************************
|
2 |
| - * Copyright (c) 2000, 2013 IBM Corporation and others. |
| 2 | + * Copyright (c) 2000, 2025 IBM Corporation and others. |
3 | 3 | *
|
4 | 4 | * This program and the accompanying materials
|
5 | 5 | * are made available under the terms of the Eclipse Public License 2.0
|
|
14 | 14 | package org.eclipse.ui.tests.api;
|
15 | 15 |
|
16 | 16 | import org.eclipse.core.resources.ResourcesPlugin;
|
| 17 | +import org.eclipse.jface.action.StatusLineManager; |
| 18 | +import org.eclipse.swt.custom.CLabel; |
| 19 | +import org.eclipse.swt.widgets.Composite; |
17 | 20 | import org.eclipse.swt.widgets.Shell;
|
18 | 21 | import org.eclipse.ui.IWorkbenchActionConstants;
|
19 | 22 | import org.eclipse.ui.IWorkbenchPage;
|
20 | 23 | import org.eclipse.ui.IWorkbenchWindow;
|
21 | 24 | import org.eclipse.ui.WorkbenchException;
|
| 25 | +import org.eclipse.ui.internal.WorkbenchWindow; |
22 | 26 | import org.eclipse.ui.tests.harness.util.ArrayUtil;
|
23 | 27 | import org.eclipse.ui.tests.harness.util.EmptyPerspective;
|
24 | 28 | import org.eclipse.ui.tests.harness.util.UITestCase;
|
@@ -197,4 +201,33 @@ public void testIsApplicationMenu() {
|
197 | 201 | assertEquals(fWin.isApplicationMenu(id), false);
|
198 | 202 | }
|
199 | 203 | }
|
| 204 | + |
| 205 | + @Test |
| 206 | + public void testRunJobInStatusLine() throws Throwable { |
| 207 | + fWin.run(false, false, monitor -> { |
| 208 | + monitor.beginTask("Task", 1); |
| 209 | + assertStatusText("Task"); |
| 210 | + }); |
| 211 | + assertStatusText(""); |
| 212 | + } |
| 213 | + |
| 214 | + @Test |
| 215 | + public void testRunJobInStatusLineWithSubtasks() throws Throwable{ |
| 216 | + fWin.run(false, false, monitor -> { |
| 217 | + monitor.beginTask("Task", 1); |
| 218 | + assertStatusText("Task"); |
| 219 | + monitor.subTask("SubTask"); |
| 220 | + assertStatusText("Task: SubTask"); |
| 221 | + monitor.subTask("OtherSubTask"); |
| 222 | + assertStatusText("Task: OtherSubTask"); |
| 223 | + }); |
| 224 | + assertStatusText(""); |
| 225 | + } |
| 226 | + |
| 227 | + private void assertStatusText(String text) { |
| 228 | + StatusLineManager statusManager = ((WorkbenchWindow) fWin).getStatusLineManager(); |
| 229 | + Composite statusLine = (Composite) statusManager.getControl(); |
| 230 | + CLabel statusLabel = (CLabel) statusLine.getChildren()[0]; |
| 231 | + assertEquals("Status line was not updated.", text, statusLabel.getText()); |
| 232 | + } |
200 | 233 | }
|
0 commit comments