Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandr Miloslavskiy2019-10-18 09:53:29 +0000
committerEric Williams2019-10-18 14:11:49 +0000
commit3b00381c169287174b26323b83945320206f055b (patch)
tree7271be181538f63f9b4937d52ec0d78c84e0f083
parent1ef69a696e82963c1b935ca9bcea9931ee143448 (diff)
downloadeclipse.platform.swt-3b00381c169287174b26323b83945320206f055b.tar.gz
eclipse.platform.swt-3b00381c169287174b26323b83945320206f055b.tar.xz
eclipse.platform.swt-3b00381c169287174b26323b83945320206f055b.zip
Bug 552209 - Test snippet
Change-Id: I751e04765b1a34e4a12230018075f01c2155cdcf 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/Bug552209_TreeWithMeasure.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug552209_TreeWithMeasure.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug552209_TreeWithMeasure.java
new file mode 100644
index 0000000000..fcf28a8d41
--- /dev/null
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug552209_TreeWithMeasure.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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 final class Bug552209_TreeWithMeasure {
+ public static void main(String[] args) {
+ final Display display = new Display();
+ final Shell shell = new Shell(display);
+ shell.setLayout(new GridLayout());
+ shell.setSize(800, 150);
+
+ Label lblHint = new Label(shell, 0);
+ lblHint.setText("Bug: 'SWTError: No more handles' exception as soon as you start the snippet");
+
+ Tree tree = new Tree(shell, SWT.NONE);
+ tree.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
+ tree.setHeaderVisible(true);
+
+ // Listeners are required to trigger the bug
+ tree.addListener(SWT.MeasureItem, arg -> {
+ });
+
+ tree.addListener(SWT.PaintItem, arg -> {
+ });
+
+ // First paint must be with no items to trigger 'Tree.gtk_draw' code from Bug 541427
+ display.timerExec(200, () -> {
+ TreeItem item = new TreeItem(tree, 0);
+ item.setText("Tree item");
+ });
+
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+ display.dispose();
+ }
+} \ No newline at end of file

Back to the top