aboutsummaryrefslogtreecommitdiff
path: root/src/testmod
diff options
context:
space:
mode:
Diffstat (limited to 'src/testmod')
-rw-r--r--src/testmod/java/dev/isxander/yacl3/test/AutogenConfigTest.java2
-rw-r--r--src/testmod/java/dev/isxander/yacl3/test/ConfigTest.java10
-rw-r--r--src/testmod/java/dev/isxander/yacl3/test/GuiTest.java67
-rw-r--r--src/testmod/resources/assets/yacl3/textures/reach-around-placement.webpbin14840 -> 0 bytes
-rw-r--r--src/testmod/resources/assets/yacl3/textures/sample-1.webpbin10474 -> 0 bytes
-rw-r--r--src/testmod/resources/assets/yacl3/textures/sample-2.webpbin22308 -> 0 bytes
-rw-r--r--src/testmod/resources/assets/yacl3/textures/sample-3.webpbin17078 -> 0 bytes
-rw-r--r--src/testmod/resources/assets/yacl3/textures/sample-4.webpbin20772 -> 0 bytes
-rw-r--r--src/testmod/resources/assets/yacl3/textures/sample-5.webpbin11166 -> 0 bytes
9 files changed, 75 insertions, 4 deletions
diff --git a/src/testmod/java/dev/isxander/yacl3/test/AutogenConfigTest.java b/src/testmod/java/dev/isxander/yacl3/test/AutogenConfigTest.java
index b3b49b6..9bb361e 100644
--- a/src/testmod/java/dev/isxander/yacl3/test/AutogenConfigTest.java
+++ b/src/testmod/java/dev/isxander/yacl3/test/AutogenConfigTest.java
@@ -24,7 +24,7 @@ import java.util.List;
public class AutogenConfigTest {
public static final ConfigClassHandler<AutogenConfigTest> INSTANCE = ConfigClassHandler.createBuilder(AutogenConfigTest.class)
- .id(new ResourceLocation("yacl3", "config"))
+ .id(new ResourceLocation("yacl3-test", "config"))
.serializer(config -> GsonConfigSerializerBuilder.create(config)
.setPath(YACLPlatform.getConfigDir().resolve("yacl-test-v2.json5"))
.setJson5(true)
diff --git a/src/testmod/java/dev/isxander/yacl3/test/ConfigTest.java b/src/testmod/java/dev/isxander/yacl3/test/ConfigTest.java
index a8f49b0..72c4454 100644
--- a/src/testmod/java/dev/isxander/yacl3/test/ConfigTest.java
+++ b/src/testmod/java/dev/isxander/yacl3/test/ConfigTest.java
@@ -37,6 +37,16 @@ public class ConfigTest {
@SerialEntry
public Color colorOption = Color.red;
@SerialEntry
+ public Color topColorOption = Color.blue;
+ @SerialEntry
+ public Color alphaColorOption = Color.green;
+ @SerialEntry
+ public Color buttonColorOption = new Color(0, 255, 255);
+ @SerialEntry
+ public Color alternativePreviewOutline = Color.white;
+ @SerialEntry
+ public Color anotherAlphaColorOption = new Color(3, 24, 255, 158);
+ @SerialEntry
public double doubleField = 0.5;
@SerialEntry
public float floatField = 0.5f;
diff --git a/src/testmod/java/dev/isxander/yacl3/test/GuiTest.java b/src/testmod/java/dev/isxander/yacl3/test/GuiTest.java
index 473b04a..34ae06a 100644
--- a/src/testmod/java/dev/isxander/yacl3/test/GuiTest.java
+++ b/src/testmod/java/dev/isxander/yacl3/test/GuiTest.java
@@ -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", "reach-around-placement.webp"))
+ .webpImage(new ResourceLocation("yacl3-test", "reach-around-placement.webp"))
.build())
.binding(
defaults.booleanToggle,
@@ -100,7 +100,6 @@ public class GuiTest {
.name(Component.literal("Custom Boolean Toggle"))
.description(val -> OptionDescription.createBuilder()
.text(Component.literal("You can customize controllers like so! YACL is truly infinitely customizable! This tooltip is long in order to demonstrate the cool, smooth scrolling of these descriptions. Did you know, they are also super clickable?! I know, cool right, YACL 3.x really is amazing."))
- .image(Path.of("D:\\Xander\\Downloads\\_MG_0860-Enhanced-NR.png"), new ResourceLocation("yacl", "f.webp")) // TODO: Add img file to git?
.build())
.binding(
defaults.customBooleanToggle,
@@ -180,7 +179,8 @@ public class GuiTest {
() -> config.colorOption,
value -> config.colorOption = value
)
- .customController(ColorController::new)
+ .controller(opt -> ColorControllerBuilder.create(opt)
+ .allowAlpha(true))
.build())
.build())
.group(OptionGroup.createBuilder()
@@ -389,6 +389,67 @@ public class GuiTest {
.build())
.build())
.category(ConfigCategory.createBuilder()
+ .name(Component.literal("Color Picker Test"))
+ .option(Option.<Color>createBuilder()
+ .name(Component.literal("Top Color Option"))
+ .binding(
+ defaults.topColorOption,
+ () -> config.topColorOption,
+ value -> config.topColorOption = value
+ )
+ .customController(ColorController::new)
+ .description(OptionDescription.of(Component.literal("A Color Controller's Color Picker will appear beneath the color if there is not enough room above it.")))
+ .build())
+ .option(LabelOption.create(Component.literal("Enabling a Color Controller's Color Picker at the top of the screen will appear beneath it if there isn't enough room above. This also applies to color controllers with alpha enabled.")))
+ .option(Option.<Color>createBuilder()
+ .name(Component.literal("Alpha Color Option"))
+ .binding(
+ defaults.alphaColorOption,
+ () -> config.alphaColorOption,
+ value -> config.alphaColorOption = value
+ )
+ .customController(opt -> new ColorController(opt, true))
+ .description(OptionDescription.of(Component.literal("A Color Picker will also allow you to choose a Color Controller's alpha if it is enabled.")))
+ .build())
+ .option(ButtonOption.createBuilder()
+ .name(Component.literal("Button \"Option\""))
+ .action((screen, opt) -> opt.setAvailable(false))
+ .build())
+ .option(LabelOption.create(Component.literal("You can try and hit the button above while the color picker below is visible, but you shouldn't be able to.")))
+ .option(Option.<Color>createBuilder()
+ .name(Component.literal("Button Color Option"))
+ .binding(
+ defaults.buttonColorOption,
+ () -> config.buttonColorOption,
+ value -> config.buttonColorOption = value
+ )
+ .customController(ColorController::new)
+ .description(OptionDescription.of(Component.literal("Other controller's buttons are disabled while a color picker is visible!")))
+ .build())
+ .option(LabelOption.create(Component.literal("The color picker button will be outlined with a light grey color instead of white if the controller's color is very light. This is all determined using the hue and value(brightness) of the color.")))
+ .option(Option.<Color>createBuilder()
+ .name(Component.literal("Alternative Color Outline"))
+ .binding(
+ defaults.alternativePreviewOutline,
+ () -> config.alternativePreviewOutline,
+ value -> config.alternativePreviewOutline = value
+ )
+ .customController(opt -> new ColorController(opt, true))
+ .description(OptionDescription.of(Component.literal("This helps users who don't know about the color picker discover it, even if a developer chooses a lighter color")))
+ .build())
+ .option(LabelOption.create(Component.literal("An extra color controller with alpha enabled to show that it too has the alternative color outline")))
+ .option(Option.<Color>createBuilder()
+ .name(Component.literal("Alpha Color Option 2"))
+ .binding(
+ defaults.anotherAlphaColorOption,
+ () -> config.anotherAlphaColorOption,
+ value -> config.anotherAlphaColorOption = value
+ )
+ .customController(opt -> new ColorController(opt, true))
+ .description(OptionDescription.of(Component.literal("Yay!!!!!!")))
+ .build())
+ .build())
+ .category(ConfigCategory.createBuilder()
.name(Component.literal("Category Test"))
.option(LabelOption.create(Component.literal("This is a test category!")))
.build())
diff --git a/src/testmod/resources/assets/yacl3/textures/reach-around-placement.webp b/src/testmod/resources/assets/yacl3/textures/reach-around-placement.webp
deleted file mode 100644
index 1937809..0000000
--- a/src/testmod/resources/assets/yacl3/textures/reach-around-placement.webp
+++ /dev/null
Binary files differ
diff --git a/src/testmod/resources/assets/yacl3/textures/sample-1.webp b/src/testmod/resources/assets/yacl3/textures/sample-1.webp
deleted file mode 100644
index 0da983e..0000000
--- a/src/testmod/resources/assets/yacl3/textures/sample-1.webp
+++ /dev/null
Binary files differ
diff --git a/src/testmod/resources/assets/yacl3/textures/sample-2.webp b/src/testmod/resources/assets/yacl3/textures/sample-2.webp
deleted file mode 100644
index e887f8c..0000000
--- a/src/testmod/resources/assets/yacl3/textures/sample-2.webp
+++ /dev/null
Binary files differ
diff --git a/src/testmod/resources/assets/yacl3/textures/sample-3.webp b/src/testmod/resources/assets/yacl3/textures/sample-3.webp
deleted file mode 100644
index eda78a9..0000000
--- a/src/testmod/resources/assets/yacl3/textures/sample-3.webp
+++ /dev/null
Binary files differ
diff --git a/src/testmod/resources/assets/yacl3/textures/sample-4.webp b/src/testmod/resources/assets/yacl3/textures/sample-4.webp
deleted file mode 100644
index 8bbe329..0000000
--- a/src/testmod/resources/assets/yacl3/textures/sample-4.webp
+++ /dev/null
Binary files differ
diff --git a/src/testmod/resources/assets/yacl3/textures/sample-5.webp b/src/testmod/resources/assets/yacl3/textures/sample-5.webp
deleted file mode 100644
index ed91379..0000000
--- a/src/testmod/resources/assets/yacl3/textures/sample-5.webp
+++ /dev/null
Binary files differ