@Test public void register() { updater.register(); triggerScrollbarSelectionChange(10); verify(updater).update(); }
@Test public void updateWithoutItems() throws Exception { equipWithItems(timeline, new Item("id", 20L) {}); updater.update(); verify(timeline, never()).setTopItem(any(Item.class)); }
@Test public void updateIfAboveTop() throws Exception { Item item = equipItemListWithItem(); getItemUiControl(item).setLocation(0, fromTopOffset(-1)); updater.update(); verify(timeline, never()).setTopItem(item); }
@Test public void updateIfBelowTopWithEqualTopItem() throws Exception { Item item = equipItemListWithItem(); equipWithTopItem(timeline, item); getItemUiControl(item).setLocation(0, fromTopOffset(1)); updater.update(); verify(timeline, never()).setTopItem(item); }
@Test public void updateIfBelowTopWithDifferentTopItem() throws Exception { Item item = equipItemListWithItem(); equipWithTopItem(timeline, new Item("other", 30L) {}); getItemUiControl(item).setLocation(0, fromTopOffset(1)); updater.update(); verify(timeline).setTopItem(item); }
@Test public void updateIfItemUiControlIsNotShowing() throws Exception { Item item = equipWithItems(timeline, new Item("id", 20L) {}); SwtItemUi<Item> itemUi = stubItemUi(displayHelper.createShell()); map(itemUiMap, item, itemUi); getItemUiControl(item).setLocation(0, fromTopOffset(1)); updater.update(); verify(timeline, never()).setTopItem(item); }
@Test public void updateWithoutItemUi() throws Exception { updater.update(); verify(timeline, never()).setTopItem(any(Item.class)); }