use of org.bukkit.event.inventory.ClickType in project Glowstone by GlowstoneMC.
the class WindowClickLogicTest method testAction.
// slot numbers are normalized: slot > 0 is 0 instead
@Test
public void testAction() {
for (String[] testCase : actionMap) {
ClickType clickType = ClickType.valueOf(testCase[0]);
int slot = Integer.parseInt(testCase[1]);
ItemStack cursor = parseItemStack(testCase[2]);
ItemStack slotItem = parseItemStack(testCase[3]);
String expected = testCase[4];
InventoryType.SlotType slotType = (slot < 0) ? InventoryType.SlotType.OUTSIDE : InventoryType.SlotType.CONTAINER;
String actual = String.valueOf(WindowClickLogic.getAction(clickType, slotType, cursor, slotItem));
assertThat("Failure for click=" + clickType + ", slot=" + slot + ", cursor=" + testCase[2] + ", slotItem=" + testCase[3], actual, is(expected));
}
}
Aggregations