public void clicking_non_empty_slot_selects_slot() { var inventoryPanel = Inventory_Helpers.GetInventoryPanelWithItems(1); var slot = inventoryPanel.Slots[0]; slot.OnPointerDown(null); Assert.AreSame(slot, inventoryPanel.Selected); }
public void clicking_empty_slot_does_not_select_slot() { var inventoryPanel = Inventory_Helpers.GetInventoryPanelWithItems(0); var slot = inventoryPanel.Slots[0]; slot.OnPointerDown(null); Assert.IsNull(inventoryPanel.Selected); }
public void raycast_target_disabled() { var inventoryPanel = Inventory_Helpers.GetInventoryPanelWithItems(); var uiCursor = Inventory_Helpers.GetSelectionCursor(); var image = uiCursor.GetComponent <Image>(); Assert.IsFalse(image.raycastTarget); }
public void in_default_state_shows_no_icon() { var inventoryPanel = Inventory_Helpers.GetInventoryPanelWithItems(1); var uiCursor = Inventory_Helpers.GetSelectionCursor(); Assert.IsFalse(uiCursor.IconVisible); Assert.IsFalse(uiCursor.GetComponent <Image>().enabled); }
public void icon_sprite_shows_when_item_selected() { var inventoryPanel = Inventory_Helpers.GetInventoryPanelWithItems(1); var uiCursor = Inventory_Helpers.GetSelectionCursor(); inventoryPanel.Slots[0].OnPointerDown(null); Assert.AreSame(inventoryPanel.Slots[0].Icon, uiCursor.Icon); }
public void icon_shows_when_item_selected() { var inventoryPanel = Inventory_Helpers.GetInventoryPanelWithItems(1); var uiCursor = Inventory_Helpers.GetSelectionCursor(); inventoryPanel.Slots[0].OnPointerDown(null); Assert.IsTrue(uiCursor.IconVisible); }
public void clicking_slot_clears_selection() { var inventoryPanel = Inventory_Helpers.GetInventoryPanelWithItems(2); var slot0 = inventoryPanel.Slots[0]; var slot1 = inventoryPanel.Slots[1]; slot0.OnPointerDown(null); Assert.IsNotNull(inventoryPanel.Selected); slot1.OnPointerDown(null); Assert.IsNull(inventoryPanel.Selected); }
public void clicking_multiple_slots_moves_selected_item() { var inventoryPanel = Inventory_Helpers.GetInventoryPanelWithItems(2); var slot0 = inventoryPanel.Slots[0]; var slot1 = inventoryPanel.Slots[1]; var item0 = slot0.Item; var item1 = slot1.Item; Assert.IsNotNull(item0); Assert.IsNotNull(item1); slot0.OnPointerDown(null); slot1.OnPointerDown(null); Assert.AreSame(item0, slot1.Item); Assert.AreSame(item1, slot0.Item); }
private Item GetItem() { return(Inventory_Helpers.GetItem()); }
private Inventory GetInventory(int numberOfItems = 0) { return(Inventory_Helpers.GetInventory(numberOfItems)); }