use of org.eclipse.jface.databinding.conformance.util.ListChangeEventTracker in project eclipse.platform.ui by eclipse-platform.
the class JavaBeanObservableListTest method testRemovesListenerAfterLastListenerIsRemoved.
@Test
public void testRemovesListenerAfterLastListenerIsRemoved() throws Exception {
ListChangeEventTracker listener = new ListChangeEventTracker();
list.addListChangeListener(listener);
assertTrue(bean.changeSupport.hasListeners(propertyName));
list.removeListChangeListener(listener);
assertFalse(bean.changeSupport.hasListeners(propertyName));
}
use of org.eclipse.jface.databinding.conformance.util.ListChangeEventTracker in project eclipse.platform.ui by eclipse-platform.
the class JavaBeanObservableListTest method testSetListChangeEvent.
@Test
public void testSetListChangeEvent() throws Exception {
String oldElement = "old";
String newElement = "new";
list.add(oldElement);
ListChangeEventTracker listener = ListChangeEventTracker.observe(list);
assertEquals(0, listener.count);
list.set(0, newElement);
assertEquals(1, listener.count);
ListChangeEvent event = listener.event;
assertSame(list, event.getObservableList());
assertDiff(event.diff, Collections.singletonList(oldElement), Collections.singletonList(newElement));
}
Aggregations