Exemplo n.º 1
0
  /** Sanity: quick check that using a ListProperty as source doesn't interfere. */
  @Test
  public void testItemsIsListProperty() {
    ObjectProperty<ObservableList<String>> itemsProperty = new SimpleObjectProperty(items);
    ListProperty<String> listItems = new SimpleListProperty<>();
    listItems.bind(itemsProperty);
    IndicesBase indicesList = new IndicesList(listItems);
    ListChangeReport report = new ListChangeReport(indicesList);
    int[] indices = new int[] {3, 5, 1};
    indicesList.addIndices(indices);
    report.clear();
    // new PrintingListChangeListener("SetAll Same size", indicesList);
    ObservableList<String> other = createObservableList(true);
    // make it not equal
    other.set(0, "otherItem");
    items.setAll(other);

    assertEquals("all cleared", 0, indicesList.size());
    assertEquals(1, report.getEventCount());
    assertTrue(
        "expected single removed, but was " + report.getLastChange(),
        wasSingleRemoved(report.getLastChange()));
  }