Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorXi Yan2018-06-15 16:34:53 +0000
committerEric Williams2018-06-18 14:50:16 +0000
commitebc68f80d66ed176ef3bb5409964b9c502d19556 (patch)
treeb23a0f02463aa0a4fb3deb91722b33ed121f65ff /tests
parente513049941efd2720b614397f551988f53eb88e6 (diff)
downloadeclipse.platform.swt-ebc68f80d66ed176ef3bb5409964b9c502d19556.tar.gz
eclipse.platform.swt-ebc68f80d66ed176ef3bb5409964b9c502d19556.tar.xz
eclipse.platform.swt-ebc68f80d66ed176ef3bb5409964b9c502d19556.zip
Bug 127132 - [GTK] TableColumn#pack does not work for virtual table
Added padding for calculating TableColumn width. Modified pack method for TableColumn to calculate size based on what is displayed for virtual tables. All tests in AllNonBrowserTests passed. Change-Id: I45a3e7b993e83cff6afe4abfe4a11c91a93128e9 Signed-off-by: Xi Yan <xixiyan@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug127132_TableColumnPackVirtual.java39
1 files changed, 17 insertions, 22 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug127132_TableColumnPackVirtual.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug127132_TableColumnPackVirtual.java
index cf60163abe..5b626db432 100644
--- a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug127132_TableColumnPackVirtual.java
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug127132_TableColumnPackVirtual.java
@@ -12,8 +12,6 @@ package org.eclipse.swt.tests.gtk.snippets;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -39,20 +37,27 @@ public class Bug127132_TableColumnPackVirtual {
Shell shell = new Shell(display);
shell.setLayout(new GridLayout());
-
-
final Table table = new Table(shell, SWT.BORDER | SWT.MULTI | SWT.VIRTUAL);
table.setLayoutData(new GridData(GridData.FILL_BOTH));
column1 = new TableColumn(table, SWT.NONE);
column1.setText("A");
column2 = new TableColumn(table, SWT.NONE);
- column1.setText("B");
+ column2.setText("B");
column3 = new TableColumn(table, SWT.NONE);
- column1.setText("C");
+ column3.setText("C");
+
+ table.setLinesVisible (true);
+ table.setHeaderVisible (true);
for (int i = 0; i < 500; i++) {
TableItem item = new TableItem(table, SWT.NONE);
- item.setText(new String[] { "cell "+i+" 0", "cell "+i+" 1", "cell "+i+" 2"});
+ if (i < 200) {
+ item.setText(new String[] { "cell "+i+" 0", "medium cell "+i+" 1", "cell "+i+" 2"});
+ } else if (i < 300) {
+ item.setText(new String[] { "medium cell "+i+" 0", "medium cell "+i+" 1", "medium cell "+i+" 2"});
+ } else {
+ item.setText(new String[] { "this is a long cell "+i+" 0", "this is a long cell "+i+" 1", "this is a long cell "+i+" 2"});
+ }
}
// These have no effects on Linux GTK?
@@ -62,21 +67,11 @@ public class Bug127132_TableColumnPackVirtual {
Button action = new Button(shell, SWT.PUSH);
action.setText("Pack Columns");
- action.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- // These have no effects on Linux GTK?
- column1.pack();
- column2.pack();
- column3.pack();
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
-
-
- }});
+ action.addListener(SWT.Selection, e -> {
+ column1.pack();
+ column2.pack();
+ column3.pack();
+ });
shell.open();
while (!shell.isDisposed()) {

Back to the top