diff options
author | René Purrio | 2018-01-09 09:48:16 +0000 |
---|---|---|
committer | Sravan Kumar Lakkimsetti | 2018-01-10 11:38:47 +0000 |
commit | 7db52abb3ee6421c843ecd6add1441d05eacd001 (patch) | |
tree | 02c4901d28e3f1a4f34c2f4bc966fdcc69df6e61 /tests | |
parent | 8dccd3a1c831a50c2932e16e9e61bc3e5a562ba4 (diff) | |
download | eclipse.platform.swt-7db52abb3ee6421c843ecd6add1441d05eacd001.tar.gz eclipse.platform.swt-7db52abb3ee6421c843ecd6add1441d05eacd001.tar.xz eclipse.platform.swt-7db52abb3ee6421c843ecd6add1441d05eacd001.zip |
Bug 529474 - [GTK] Fix array initialization problem
- Added test for treeitems also.
- Added test for third column as well
Change-Id: Ia16837a105bad053948faa079ab328aba88a8100
Signed-off-by: René Purrio <rpurrio@itemis.de>
Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
Diffstat (limited to 'tests')
2 files changed, 54 insertions, 2 deletions
diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java index b6eb4872f6..7b899772fa 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TableItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * 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 @@ -839,6 +839,32 @@ public void test_setTextILjava_lang_String(){ } + /* + * Test the getText/setText API with a small table that + * will be extended by a column: + * First the table has only one column and one row (TableItem) with text. + * Then it is extended by one more column. + * After this the existing row gets one more text for the new column. + */ + + makeCleanEnvironment(); + + //create first column and set row text + new TableColumn(table, SWT.NONE); + tableItem = new TableItem (table, SWT.NONE); + tableItem.setText(0, TestString); + assertEquals(TestString, tableItem.getText(0)); + + //create second column and set a second text in the same row + new TableColumn(table, SWT.NONE); + tableItem.setText(1, TestString); + assertEquals(TestString, tableItem.getText(1)); + + //create third column and set a third text in the same row + new TableColumn(table, SWT.NONE); + tableItem.setText(2, TestString); + assertEquals(TestString, tableItem.getText(2)); + } /* custom */ diff --git a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java index 39df376e68..ec4c573c03 100644 --- a/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java +++ b/tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_widgets_TreeItem.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * 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 @@ -1141,6 +1141,32 @@ public void test_setTextILjava_lang_String(){ catch (IllegalArgumentException e) { } + /* + * Test the getText/setText API with a small table that + * will be extended by a column: + * First the table has only one column and one row (TableItem) with text. + * Then it is extended by one more column. + * After this the existing row gets one more text for the new column. + */ + + makeCleanEnvironment(); + + //create first column and set row text + new TreeColumn(tree, SWT.NONE); + treeItem = new TreeItem (tree, SWT.NONE); + treeItem.setText(0, TestString); + assertEquals(TestString, treeItem.getText(0)); + + //create second column and set a second text in the same row + new TreeColumn(tree, SWT.NONE); + treeItem.setText(1, TestString); + assertEquals(TestString, treeItem.getText(1)); + + //create third column and set a third text in the same row + new TreeColumn(tree, SWT.NONE); + treeItem.setText(2, TestString); + assertEquals(TestString, treeItem.getText(2)); + } |