Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandr Miloslavskiy2019-10-18 14:23:45 +0000
committerAlexandr Miloslavskiy2019-10-18 14:28:35 +0000
commitbf3e4bcc334da38c630353e415e8824a08bacb6a (patch)
tree3ea7767dc82e2fc61e2589b7e0151bd3d452e457
parent3b00381c169287174b26323b83945320206f055b (diff)
downloadeclipse.platform.swt-bf3e4bcc334da38c630353e415e8824a08bacb6a.tar.gz
eclipse.platform.swt-bf3e4bcc334da38c630353e415e8824a08bacb6a.tar.xz
eclipse.platform.swt-bf3e4bcc334da38c630353e415e8824a08bacb6a.zip
Bug 552215 - Test snippet
Change-Id: I2fe0a9274dde5f708f0834950d4a5247e43606c3 Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
-rw-r--r--tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug552215_TreeFlickering_getClientArea.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug552215_TreeFlickering_getClientArea.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug552215_TreeFlickering_getClientArea.java
new file mode 100644
index 0000000000..2122490a01
--- /dev/null
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug552215_TreeFlickering_getClientArea.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Syntevo and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Syntevo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.tests.gtk.snippets;
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+
+public class Bug552215_TreeFlickering_getClientArea {
+ public static void main(String[] args) {
+ final Display display = new Display();
+ final Shell shell = new Shell(display);
+ shell.setLayout(new GridLayout());
+
+ Label lblHint = new Label(shell, 0);
+ lblHint.setText("Bug: Move mouse over Tree items => flickering");
+
+ Tree tree = new Tree(shell, SWT.NONE);
+ tree.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
+
+ // Countermeasures for Bug 550606
+ tree.setHeaderVisible(true);
+
+ // This is what causes flickering
+ tree.addListener(SWT.EraseItem, event -> {
+ tree.getClientArea();
+ });
+
+ // First paint must be with no items to trigger 'Tree.gtk_draw' code from Bug 541427
+ display.timerExec(1000, () -> {
+ for (int i = 0; i < 20; i++) {
+ final TreeItem rootNode = new TreeItem(tree, SWT.NONE);
+ rootNode.setText("node " + i);
+ }
+ });
+
+ shell.setSize(400, 600);
+ shell.open();
+
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+
+ display.dispose();
+ }
+}

Back to the top