Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandr Miloslavskiy2019-10-21 13:05:07 +0000
committerEric Williams2019-10-28 13:37:11 +0000
commit176c61275918a28b2ae7cee3fd080a98b8b4d234 (patch)
tree18caba5fcbf08fe727ddf088605f97076ca5b47a /tests/org.eclipse.swt.tests.gtk/ManualTests/org
parentd73c8c662b22615a3c159d4d9be7c1c1ec217783 (diff)
downloadeclipse.platform.swt-176c61275918a28b2ae7cee3fd080a98b8b4d234.tar.gz
eclipse.platform.swt-176c61275918a28b2ae7cee3fd080a98b8b4d234.tar.xz
eclipse.platform.swt-176c61275918a28b2ae7cee3fd080a98b8b4d234.zip
Bug 552215 - Better test snippets for 541427
Change-Id: I4a71479fece2220ad9114473e6ac6913e630e9bd Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Diffstat (limited to 'tests/org.eclipse.swt.tests.gtk/ManualTests/org')
-rw-r--r--tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug541427_TreeNoHeader.java83
1 files changed, 83 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug541427_TreeNoHeader.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug541427_TreeNoHeader.java
new file mode 100644
index 0000000000..9b2bf356a2
--- /dev/null
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug541427_TreeNoHeader.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2018 Matthew Khouzam and others. All rights reserved.
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ *
+ * Contributors:
+ * Matthew Khouzam - initial API and implementation
+ * Syntevo - more tests
+ *******************************************************************************/
+package org.eclipse.swt.tests.gtk.snippets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+
+public class Bug541427_TreeNoHeader {
+ public static void main(String[] args) {
+ // boilerplate
+ Display display = new Display();
+ Shell shell = new Shell(display);
+ shell.setLayout(new RowLayout(SWT.HORIZONTAL));
+
+ for (int iTests = 0; iTests < (1 << 2); iTests++)
+ {
+ final boolean USE_NO_SCROLL = (iTests & (1 << 0)) != 0;
+ final boolean PACK_BEFORE_SIZE = (iTests & (1 << 1)) != 0;
+
+ Composite testComposite = new Composite(shell, 0);
+ testComposite.setLayout(new RowLayout(SWT.VERTICAL));
+
+ for (int iHeightDiff = -5; iHeightDiff <= 5; iHeightDiff++)
+ {
+ Group group = new Group(testComposite, 0);
+ group.setText(String.format(
+ "%+d %c%c",
+ iHeightDiff,
+ USE_NO_SCROLL ? 'N' : '_',
+ PACK_BEFORE_SIZE ? 'P' : '_'
+ ));
+
+ final Tree tree = new Tree(group, USE_NO_SCROLL ? SWT.NO_SCROLL : 0);
+ tree.setHeaderVisible(true);
+
+ // Remember header height before creating columns.
+ // It returns 0 after a column is created, is that another bug?
+ int treeH = tree.getHeaderHeight() + iHeightDiff;
+
+ // some columns. 1 is already enough to demonstrate
+ for (int iColumn = 0; iColumn < 3; iColumn++)
+ {
+ TreeColumn column = new TreeColumn(tree, SWT.NONE);
+ column.setText("Column");
+ column.setWidth(70);
+ }
+
+ if (PACK_BEFORE_SIZE)
+ tree.pack();
+
+ tree.setBounds(0, 0, 220, treeH);
+ }
+ }
+
+ // boilerplate
+ shell.pack();
+ shell.open();
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ display.dispose();
+ }
+} \ No newline at end of file

Back to the top