예제 #1
0
 /**
  * Since extraction of IndicesBase Changed behaviour of sourceChange: valid only from before
  * endChange to after endChange!
  */
 @Test
 @Ignore
 public void testSourceChangeNotificationSequence() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   report.clear();
   List<Object> changes = new ArrayList();
   ChangeListener cpl = (source, old, value) -> changes.add(value);
   indicesList.sourceChangeProperty().addListener(cpl);
   ListChangeListener lcl = c -> changes.add(c);
   indicesList.addListener(lcl);
   ChangeReport cr = new ChangeReport(indicesList.sourceChangeProperty());
   items.add(0, "something");
   assertEquals(2, changes.size());
   assertEquals(cr.getLastNewValue(), changes.get(0));
   assertEquals(report.getLastChange(), changes.get(1));
 }
예제 #2
0
 /**
  * Try to let indexMappedItems handle their own cleanup on changes to items: make sourceChange a
  * property and test if we can force notification order.
  *
  * <p>Changed implementation: the sourceChange is != only from before endChange to after
  * endChange, so we get 2 notifications, the last with a null.
  */
 @Test
 public void testSourceChangeProperty() {
   int[] indices = new int[] {3, 5, 1};
   indicesList.addIndices(indices);
   report.clear();
   ChangeReport cr = new ChangeReport(indicesList.sourceChangeProperty());
   items.add(0, "something");
   assertEquals(2, cr.getEventCount());
   //        Change c = (Change) cr.getLastOldValue(0);
   //        // PENDING JW: really? there might be several listeners (theoretically)
   //        // with no responsibility to reset the change - such that each
   //        // interested party has to reset before usage anyway
   //        assertTrue("expect change reset", c.next());
 }