diff options
Diffstat (limited to 'tests/org.eclipse.swt.tests.gtk')
4 files changed, 116 insertions, 2 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/META-INF/MANIFEST.MF b/tests/org.eclipse.swt.tests.gtk/META-INF/MANIFEST.MF index 36a60085bc..29dc8f69be 100644 --- a/tests/org.eclipse.swt.tests.gtk/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.swt.tests.gtk/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.swt.tests.gtk -Bundle-Version: 3.106.0.qualifier +Bundle-Version: 3.107.100.qualifier Bundle-Vendor: %providerName Require-Bundle: org.junit;bundle-version="4.12.0", org.eclipse.swt diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug258196_VirtualTreeResizing.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug258196_VirtualTreeResizing.java new file mode 100644 index 0000000000..d7c60a83b3 --- /dev/null +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug258196_VirtualTreeResizing.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2018 Red Hat and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Red Hat - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.tests.gtk.snippets; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeItem; + +public class Bug258196_VirtualTreeResizing { + public static void main(String[] args) { + final Display display = new Display(); + final Shell shell = new Shell(display); + shell.setLayout (new FillLayout()); + final Tree tree = new Tree(shell, SWT.VIRTUAL | SWT.BORDER); + tree.addListener(SWT.SetData, event -> { + final TreeItem item = (TreeItem)event.item; + TreeItem parentItem = item.getParentItem(); + String text = null; + if (parentItem == null) { + text = "node "+tree.indexOf(item); + } else { + text = parentItem.getText()+" - "+parentItem.indexOf(item); + } + item.setData(text); + item.setItemCount(10); + display.asyncExec(() -> { + if (!item.isDisposed()) { + item.setText(item.getData().toString()); + } + }); + }); + tree.setItemCount(20); + shell.setSize(400, 300); + shell.open(); + while (!shell.isDisposed ()) { + if (!display.readAndDispatch ()) display.sleep (); + } + display.dispose (); + } +} diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug490203_VirtualTreePerf.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug490203_VirtualTreePerf.java new file mode 100644 index 0000000000..8c713e2de0 --- /dev/null +++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug490203_VirtualTreePerf.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2000, 2018 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.swt.tests.gtk.snippets; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.RowData; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeItem; + +public class Bug490203_VirtualTreePerf { + static final int COUNT = 10_000; + + public static void main(String[] args) { + Display display = new Display (); + final Shell shell = new Shell (display); + shell.setLayout (new RowLayout (SWT.VERTICAL)); + final Tree tree = new Tree (shell, SWT.VIRTUAL | SWT.BORDER); + TreeItem[] top = { null }; + tree.addListener (SWT.SetData, event -> { + TreeItem item = (TreeItem) event.item; + if (item.getParentItem() == null) { + top[0] = item; + item.setText("top"); + } else { + int index = top[0].indexOf (item); + item.setText ("Item " + index); + } + System.out.println (item.getText ()); + }); + tree.setLayoutData (new RowData (200, 200)); + Button button = new Button (shell, SWT.PUSH); + button.setText ("&Add Items"); + final Label label = new Label(shell, SWT.NONE); + button.addListener (SWT.Selection, event -> { + long t1 = System.currentTimeMillis (); + top[0].setItemCount (COUNT); + top[0].setExpanded(true); + long t2 = System.currentTimeMillis (); + label.setText ("Items: " + COUNT + ", Time: " + (t2 - t1) + " (ms)"); + shell.layout (); + }); + tree.setItemCount (1); + shell.pack (); + shell.open (); + while (!shell.isDisposed ()) { + if (!display.readAndDispatch ()) display.sleep (); + } + display.dispose (); + } +} diff --git a/tests/org.eclipse.swt.tests.gtk/pom.xml b/tests/org.eclipse.swt.tests.gtk/pom.xml index eb1a9bbb61..3720418b87 100644 --- a/tests/org.eclipse.swt.tests.gtk/pom.xml +++ b/tests/org.eclipse.swt.tests.gtk/pom.xml @@ -19,7 +19,7 @@ </parent> <groupId>org.eclipse.swt</groupId> <artifactId>org.eclipse.swt.tests.gtk</artifactId> - <version>3.106.0-SNAPSHOT</version> + <version>3.107.100-SNAPSHOT</version> <packaging>eclipse-test-plugin</packaging> <properties> <code.ignoredWarnings>${tests.ignoredWarnings}</code.ignoredWarnings> |