summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Dukadinov2012-03-23 06:46:18 (EDT)
committerJordan Dukadinov2012-04-04 09:01:14 (EDT)
commit0da33d8a5744983bf04a10ad000b6840863e3bc4 (patch)
treece6f5c892895fc182845770392dfab6175a0721b
parentfc59407fa91cbcb54e437b2743cd8516ea54aed1 (diff)
downloadorg.eclipse.riena-0da33d8a5744983bf04a10ad000b6840863e3bc4.zip
org.eclipse.riena-0da33d8a5744983bf04a10ad000b6840863e3bc4.tar.gz
org.eclipse.riena-0da33d8a5744983bf04a10ad000b6840863e3bc4.tar.bz2
Test case for the wrong column width calculation - Bug 301682
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TableRidgetTest.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TableRidgetTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TableRidgetTest.java
index 90215b6..925de32 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TableRidgetTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/internal/ui/ridgets/swt/TableRidgetTest.java
@@ -22,6 +22,7 @@ import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.list.WritableList;
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.jface.viewers.ColumnPixelData;
+import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
@@ -87,6 +88,24 @@ public class TableRidgetTest extends AbstractTableListRidgetTest {
// test methods
// /////////////
+ /**
+ * Bug 301682
+ */
+ public void testSetColumnWidthsRelative() {
+ final ITableRidget ridget = createRidget();
+ final Table table = createWidget(getShell());
+ ridget.setUIControl(table);
+
+ final String[] columns3 = { Person.PROPERTY_FIRSTNAME, Person.PROPERTY_LASTNAME, Person.PROPERTY_BIRTHDAY };
+ ridget.bindToModel(manager, "persons", Person.class, columns3, null); //$NON-NLS-1$
+ ridget.updateFromModel();
+
+ ridget.setColumnWidths(new Object[] { new ColumnWeightData(1), new ColumnWeightData(2), new ColumnWeightData(3) });
+
+ assertTrue("column 0 should be smaller than column 1", table.getColumn(0).getWidth() < table.getColumn(1).getWidth()); //$NON-NLS-1$
+ assertTrue("column 1 should be smaller than column 2", table.getColumn(1).getWidth() < table.getColumn(2).getWidth()); //$NON-NLS-1$
+ }
+
public void testRidgetMapping() {
final SwtControlRidgetMapper mapper = SwtControlRidgetMapper.getInstance();
assertSame(TableRidget.class, mapper.getRidgetClass(getWidget()));