aboutsummaryrefslogtreecommitdiff
path: root/src/testmod
diff options
context:
space:
mode:
authorisXander <xander@isxander.dev>2024-04-14 21:11:32 +0100
committerisXander <xander@isxander.dev>2024-04-14 21:11:32 +0100
commit26aec79e10025ff3427ceb47602156ebd670b2ac (patch)
tree280515927ea98bc510385d81de2d508f94910126 /src/testmod
parentbb0690af2536edf9ff920c0c229de8b919215850 (diff)
downloadYetAnotherConfigLib-26aec79e10025ff3427ceb47602156ebd670b2ac.tar.gz
YetAnotherConfigLib-26aec79e10025ff3427ceb47602156ebd670b2ac.tar.bz2
YetAnotherConfigLib-26aec79e10025ff3427ceb47602156ebd670b2ac.zip
Fix gifs not being preloaded + add testmod samples
Diffstat (limited to 'src/testmod')
-rw-r--r--src/testmod/java/dev/isxander/yacl3/test/GuiTest.java16
-rw-r--r--src/testmod/resources/assets/yacl_test/textures/images/sample1.webpbin0 -> 10474 bytes
-rw-r--r--src/testmod/resources/assets/yacl_test/textures/images/sample3.webpbin0 -> 2058520 bytes
-rw-r--r--src/testmod/resources/assets/yacl_test/textures/images/sample4.gifbin0 -> 13717 bytes
4 files changed, 13 insertions, 3 deletions
diff --git a/src/testmod/java/dev/isxander/yacl3/test/GuiTest.java b/src/testmod/java/dev/isxander/yacl3/test/GuiTest.java
index 34ae06a..3ddfce6 100644
--- a/src/testmod/java/dev/isxander/yacl3/test/GuiTest.java
+++ b/src/testmod/java/dev/isxander/yacl3/test/GuiTest.java
@@ -64,7 +64,7 @@ public class GuiTest {
private static Screen getFullTestSuite(Screen parent) {
AtomicReference<Option<Boolean>> booleanOption = new AtomicReference<>();
- ConfigTest.GSON.serializer().load();
+ ConfigTest.GSON.load();
return YetAnotherConfigLib.create(ConfigTest.GSON, (defaults, config, builder) -> builder
.title(Component.literal("Test GUI"))
.category(ConfigCategory.createBuilder()
@@ -83,7 +83,7 @@ public class GuiTest {
.append(Component.literal("e").withStyle(style -> style.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("e")))))
.withStyle(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://isxander.dev")))
)
- .webpImage(new ResourceLocation("yacl3-test", "reach-around-placement.webp"))
+ .webpImage(imageSample("sample1.webp"))
.build())
.binding(
defaults.booleanToggle,
@@ -113,7 +113,10 @@ public class GuiTest {
.build())
.option(Option.<Boolean>createBuilder()
.name(Component.literal("Tick Box"))
- .description(OptionDescription.of(Component.literal("There are even alternate methods of displaying the same data type!")))
+ .description(OptionDescription.createBuilder()
+ .text(Component.literal("There are even alternate methods of displaying the same data type!"))
+ .webpImage(imageSample("sample3.webp"))
+ .build())
.binding(
defaults.tickbox,
() -> config.tickbox,
@@ -126,6 +129,9 @@ public class GuiTest {
.name(Component.literal("Slider Controllers"))
.option(Option.<Integer>createBuilder()
.name(Component.literal("Int Slider"))
+ .description(OptionDescription.createBuilder()
+ .gifImage(imageSample("sample4.gif"))
+ .build())
.binding(
defaults.intSlider,
() -> config.intSlider,
@@ -489,6 +495,10 @@ public class GuiTest {
.generateScreen(parent);
}
+ private static ResourceLocation imageSample(String name) {
+ return new ResourceLocation("yacl_test", "textures/images/" + name);
+ }
+
private static boolean myBooleanOption = true;
private static Screen getWikiGetStarted(Screen parent) {
diff --git a/src/testmod/resources/assets/yacl_test/textures/images/sample1.webp b/src/testmod/resources/assets/yacl_test/textures/images/sample1.webp
new file mode 100644
index 0000000..0da983e
--- /dev/null
+++ b/src/testmod/resources/assets/yacl_test/textures/images/sample1.webp
Binary files differ
diff --git a/src/testmod/resources/assets/yacl_test/textures/images/sample3.webp b/src/testmod/resources/assets/yacl_test/textures/images/sample3.webp
new file mode 100644
index 0000000..bc91220
--- /dev/null
+++ b/src/testmod/resources/assets/yacl_test/textures/images/sample3.webp
Binary files differ
diff --git a/src/testmod/resources/assets/yacl_test/textures/images/sample4.gif b/src/testmod/resources/assets/yacl_test/textures/images/sample4.gif
new file mode 100644
index 0000000..9231bae
--- /dev/null
+++ b/src/testmod/resources/assets/yacl_test/textures/images/sample4.gif
Binary files differ