-
-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
20b8981
commit 91059e0
Showing
5 changed files
with
126 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/test/java/org/skriptlang/skript/test/tests/syntaxes/InventoryMoveItemEventTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* This file is part of Skript. | ||
* | ||
* Skript is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Skript is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Skript. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* Copyright Peter Güttinger, SkriptLang team and contributors | ||
*/ | ||
package org.skriptlang.skript.test.tests.syntaxes; | ||
|
||
import ch.njol.skript.test.runner.SkriptJUnitTest; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.Material; | ||
import org.bukkit.event.inventory.InventoryMoveItemEvent; | ||
import org.bukkit.event.inventory.InventoryType; | ||
import org.bukkit.inventory.Inventory; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.junit.Test; | ||
|
||
// TODO properly add test after merge of https://github.com/SkriptLang/Skript/pull/6261 | ||
public class InventoryMoveItemEventTest extends SkriptJUnitTest { | ||
|
||
static { | ||
setShutdownDelay(1); | ||
} | ||
|
||
@Test | ||
public void test() { | ||
Inventory chestInventory = Bukkit.createInventory(null, InventoryType.CHEST); | ||
ItemStack itemStack = new ItemStack(Material.STONE); | ||
Inventory hopperInventory = Bukkit.createInventory(null, InventoryType.HOPPER); | ||
Bukkit.getPluginManager().callEvent(new InventoryMoveItemEvent(chestInventory, itemStack, hopperInventory, false)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
# TODO properly add test after merge of https://github.com/SkriptLang/Skript/pull/6261 | ||
options: | ||
junit: org.skriptlang.skript.test.tests.syntaxes.InventoryMoveItemEventTest | ||
objective: inventory move item event success | ||
|
||
on script load: | ||
ensure junit test "{@junit}" completes "{@objective}" | ||
|
||
on inventory item move: | ||
assert type of event-initiator-inventory is a hopper inventory with "event-initiator-inventory should be a hopper inventory, but got %type of event-initiator-inventory%" | ||
assert type of event-inventory is a chest inventory with "past event-inventory should be a chest inventory, but got %type of past event-inventory%" | ||
assert type of future event-inventory is a hopper inventory with "event-inventory should be a hopper inventory, but got %type of event-inventory%" | ||
assert type of event-item is a stone with "event-item should be a stone, but got %type of event-item%" | ||
complete objective "{@objective}" for junit test "{@junit}" |