-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from Placeblock/dev-simpleclickfix
Dev simpleclickfix
- Loading branch information
Showing
4 changed files
with
78 additions
and
2 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
50 changes: 50 additions & 0 deletions
50
api/src/test/java/de/placeblock/betterinventories/SimpleGUIPaneTest.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,50 @@ | ||
package de.placeblock.betterinventories; | ||
|
||
import be.seeseemelk.mockbukkit.MockBukkit; | ||
import be.seeseemelk.mockbukkit.MockPlugin; | ||
import de.placeblock.betterinventories.builder.content.GUIButtonBuilder; | ||
import de.placeblock.betterinventories.builder.content.SimpleGUIPaneBuilder; | ||
import de.placeblock.betterinventories.builder.gui.ChestGUIBuilder; | ||
import de.placeblock.betterinventories.content.item.GUIButton; | ||
import de.placeblock.betterinventories.content.item.GUIItem; | ||
import de.placeblock.betterinventories.content.pane.impl.simple.SimpleGUIPane; | ||
import de.placeblock.betterinventories.gui.impl.ChestGUI; | ||
import net.kyori.adventure.text.Component; | ||
import org.bukkit.Material; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class SimpleGUIPaneTest { | ||
private MockPlugin plugin; | ||
|
||
@BeforeEach | ||
public void setup() { | ||
MockBukkit.getOrCreateMock(); | ||
this.plugin = MockBukkit.createMockPlugin(); | ||
} | ||
|
||
@Test | ||
public void zIndexTest() { | ||
ChestGUI chestGUI = new ChestGUIBuilder(this.plugin) | ||
.height(3) | ||
.title(Component.empty()) | ||
.build(); | ||
SimpleGUIPane pane = new SimpleGUIPaneBuilder(chestGUI) | ||
.adoptMinMax(chestGUI.getCanvas()) | ||
.build(); | ||
chestGUI.getCanvas().setSection(pane); | ||
SimpleGUIPane fillPane = new SimpleGUIPaneBuilder(chestGUI) | ||
.adoptMinMax(chestGUI.getCanvas()) | ||
.build(); | ||
fillPane.fill(new GUIItem(chestGUI, new ItemStack(Material.CHEST))); | ||
pane.setSection(fillPane); | ||
GUIButton button = new GUIButtonBuilder(chestGUI) | ||
.item(new ItemStack(Material.DIAMOND)) | ||
.build(); | ||
pane.setSectionAt(2, button); | ||
chestGUI.update(); | ||
assert chestGUI.getClickedSection(2).equals(button); | ||
} | ||
|
||
} |