Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Keller2012-08-28 13:02:02 +0000
committerMarkus Keller2012-08-28 13:02:02 +0000
commit61eb7c2f54751c7860b33e1a6bc644a3a43647da (patch)
tree04ac0279f3e66d43f25b24858fc767956af4afbe /org.eclipse.ui.workbench.texteditor.tests
parent30ddc1675a17f0abf9c32fc1b490d55fe2bd232b (diff)
downloadeclipse.platform.text-61eb7c2f54751c7860b33e1a6bc644a3a43647da.tar.gz
eclipse.platform.text-61eb7c2f54751c7860b33e1a6bc644a3a43647da.tar.xz
eclipse.platform.text-61eb7c2f54751c7860b33e1a6bc644a3a43647da.zip
wiggle the mouse and dump more info to track down gray screen on Windows
Diffstat (limited to 'org.eclipse.ui.workbench.texteditor.tests')
-rw-r--r--org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java46
1 files changed, 41 insertions, 5 deletions
diff --git a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java
index b63293134..ce3404cdf 100644
--- a/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java
+++ b/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java
@@ -11,6 +11,7 @@
package org.eclipse.ui.workbench.texteditor.tests;
import java.io.File;
+import java.io.PrintStream;
import java.util.ResourceBundle;
import junit.framework.Test;
@@ -24,6 +25,7 @@ import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageLoader;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
@@ -222,16 +224,50 @@ public class FindReplaceDialogTest extends TestCase {
return takeScreenshot(FindReplaceDialogTest.class, getName());
}
- private static String takeScreenshot(Class testClass, String testName) {
- File resultsHtmlDir= getJunitReportOutput();
+ private String takeScreenshot(Class testClass, String testName) {
+ File resultsHtmlDir= getJunitReportOutput(); // ends up in testresults/linux.gtk.x86_6.0/<class>.<test>.png
if (resultsHtmlDir == null) { // fallback, NOT platform-dependent:
File eclipseDir= new File("").getAbsoluteFile(); // eclipse-testing/test-eclipse/eclipse
- resultsHtmlDir= new File(eclipseDir, "../../results/html/").getAbsoluteFile();
+ resultsHtmlDir= new File(eclipseDir, "../../results/html/").getAbsoluteFile(); // ends up in testresults/html/<class>.<test>.png
}
- // Take a screenshot:
+ PrintStream out= System.out;
+
Display display= Display.getDefault();
+
+ // Wiggle the mouse:
+ Event mouseMove= new Event();
+ mouseMove.x= 10;
+ mouseMove.y= 10;
+ display.post(mouseMove);
+ runEventQueue();
+ mouseMove.x= 20;
+ mouseMove.y= 20;
+ display.post(mouseMove);
+ runEventQueue();
+
+ // Dump focus control, parents, and shells:
+ Control focusControl = display.getFocusControl();
+ if (focusControl != null) {
+ out.println("FocusControl: ");
+ StringBuffer indent = new StringBuffer(" ");
+ do {
+ out.println(indent.toString() + focusControl);
+ focusControl = focusControl.getParent();
+ indent.append(" ");
+ } while (focusControl != null);
+ }
+ Shell[] shells = display.getShells();
+ if (shells.length > 0) {
+ out.println("Shells: ");
+ for (int i = 0; i < shells.length; i++) {
+ Shell shell = shells[i];
+ out.println((shell.isVisible() ? " visible: " : " invisible: ") + shell);
+ }
+ }
+
+ // Take a screenshot:
GC gc = new GC(display);
final Image image = new Image(display, display.getBounds());
gc.copyArea(image, 0, 0);
@@ -244,7 +280,7 @@ public class FindReplaceDialogTest extends TestCase {
ImageLoader loader = new ImageLoader();
loader.data = new ImageData[] { image.getImageData() };
loader.save(filename, SWT.IMAGE_PNG);
- System.err.println("Screenshot saved to: " + filename);
+ out.println("Screenshot saved to: " + filename);
image.dispose();
return filename;
}

Back to the top