aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/ListViewerTest.java')
-rw-r--r--tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/ListViewerTest.java50
1 files changed, 25 insertions, 25 deletions
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/ListViewerTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/ListViewerTest.java
index 2a4dc93..0cbbcec 100644
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/ListViewerTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/ListViewerTest.java
@@ -27,8 +27,8 @@ public class ListViewerTest extends StructuredViewerTest {
super(name);
}
- protected StructuredViewer createViewer(Composite parent) {
- ListViewer viewer = new ListViewer(parent);
+ protected StructuredViewer<TestElement,TestElement>createViewer(Composite parent) {
+ ListViewer<TestElement,TestElement> viewer = new ListViewer<TestElement,TestElement>(parent);
viewer.setContentProvider(new TestModelContentProvider());
return viewer;
}
@@ -47,30 +47,30 @@ public class ListViewerTest extends StructuredViewerTest {
public static void main(String args[]) {
junit.textui.TestRunner.run(ListViewerTest.class);
}
-
+
public void testInsert() {
- ListViewer v = ((ListViewer)fViewer);
+ ListViewer<TestElement,TestElement> v = ((ListViewer<TestElement,TestElement>)fViewer);
TestElement element = new TestElement(fModel, fRootElement);
v.insert(element, 1);
assertSame("test insert", element, v.getElementAt(1));
assertEquals("test insert", element.toString(), v.getList().getItem(1));
-
+
v.addFilter(new ViewerFilter() {
public boolean select(Viewer viewer, Object parentElement, Object element) {
return true;
}
});
-
+
TestElement element1 = new TestElement(fModel, fRootElement);
v.insert(element1, 1);
assertNotSame("test insert", element1, v.getElementAt(1));
-
+
v.setFilters(new ViewerFilter[0]);
v.remove(element);
v.remove(element1);
}
-
+
public void testRevealBug69076() {
// TODO remove the Mac OS check when SWT has fixed the bug in List.java
// see bug 116105
@@ -92,7 +92,7 @@ public class ListViewerTest extends StructuredViewerTest {
.getFirstChild()), true);
TestElement child = fRootElement.getChildAt(j);
fViewer.reveal(child);
- List list = ((ListViewer) fViewer).getList();
+ List list = ((ListViewer<TestElement,TestElement>) fViewer).getList();
int topIndex = list.getTopIndex();
// even though we pass in reveal=false, SWT still scrolls to show the selection (since 20020815)
fViewer.setSelection(new StructuredSelection(child), false);
@@ -104,10 +104,10 @@ public class ListViewerTest extends StructuredViewerTest {
}
}
}
-
+
/**
* Asserts the ability to refresh a List that contains no selection without losing vertically scrolled state.
- *
+ *
* @throws Exception
*/
public void testRefreshBug141435() throws Exception {
@@ -119,43 +119,43 @@ public class ListViewerTest extends StructuredViewerTest {
openBrowser();
TestElement model = TestElement.createModel(1, 50);
fViewer.setInput(model);
-
+
int lastIndex = model.getChildCount() - 1;
-
+
//Scroll...
fViewer.reveal(model.getChildAt(lastIndex));
List list = (List) fViewer.getControl();
int topIndex = list.getTopIndex();
-
+
assertTrue("Top item should not be the first item.", topIndex != 0);
fViewer.refresh();
processEvents();
assertEquals("Top index was not preserved after refresh.", topIndex, list.getTopIndex());
-
+
//Assert that when the previous top index after refresh is invalid no exceptions are thrown.
model.deleteChildren();
-
+
try {
fViewer.refresh();
assertEquals(0, list.getTopIndex());
} catch (Exception e) {
fail("Refresh failure when refreshing with an empty model.");
- }
+ }
}
-
+
public void testSelectionRevealBug177619() throws Exception {
TestElement model = TestElement.createModel(1, 100);
fViewer.setInput(model);
-
- fViewer.setSelection(new StructuredSelection(((ListViewer)fViewer).getElementAt(50)),true);
- assertTrue(((ListViewer)fViewer).getList().getTopIndex() != 0);
+
+ fViewer.setSelection(new StructuredSelection(((ListViewer<TestElement,TestElement>)fViewer).getElementAt(50)),true);
+ assertTrue(((ListViewer<TestElement,TestElement>)fViewer).getList().getTopIndex() != 0);
}
-
+
public void testSelectionNoRevealBug177619() throws Exception {
TestElement model = TestElement.createModel(1, 100);
fViewer.setInput(model);
-
- fViewer.setSelection(new StructuredSelection(((ListViewer)fViewer).getElementAt(50)),false);
- assertTrue(((ListViewer)fViewer).getList().getTopIndex() == 0);
+
+ fViewer.setSelection(new StructuredSelection(((ListViewer<TestElement,TestElement>)fViewer).getElementAt(50)),false);
+ assertTrue(((ListViewer<TestElement,TestElement>)fViewer).getList().getTopIndex() == 0);
}
}