From 6b80460d7e3566d8e102ce799aa562adcd9b926d Mon Sep 17 00:00:00 2001 From: Juuz <6596629+Juuxel@users.noreply.github.com> Date: Thu, 2 Feb 2023 18:28:46 +0200 Subject: Add test for #182 --- .../github/cottonmc/test/client/Issue182TestGui.java | 18 ++++++++++++++++++ .../github/cottonmc/test/client/LibGuiTestClient.java | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 GuiTest/src/main/java/io/github/cottonmc/test/client/Issue182TestGui.java (limited to 'GuiTest/src/main/java/io') diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/client/Issue182TestGui.java b/GuiTest/src/main/java/io/github/cottonmc/test/client/Issue182TestGui.java new file mode 100644 index 0000000..5d4a739 --- /dev/null +++ b/GuiTest/src/main/java/io/github/cottonmc/test/client/Issue182TestGui.java @@ -0,0 +1,18 @@ +package io.github.cottonmc.test.client; + +import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription; +import io.github.cottonmc.cotton.gui.widget.WBox; +import io.github.cottonmc.cotton.gui.widget.WTextField; +import io.github.cottonmc.cotton.gui.widget.data.Axis; + +// Used for testing issue #182 (https://github.com/CottonMC/LibGui/issues/182): +// Highlighting/selecting text in the top field makes the bottom one blue. +public final class Issue182TestGui extends LightweightGuiDescription { + public Issue182TestGui() { + WBox root = new WBox(Axis.VERTICAL); + root.add(new WTextField(), 100, 20); + root.add(new WTextField(), 100, 20); + setRootPanel(root); + root.validate(this); + } +} diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java b/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java index ead774b..794264c 100644 --- a/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java +++ b/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java @@ -56,7 +56,7 @@ public class LibGuiTestClient implements ClientModInitializer { var vert = IntegerArgumentType.getInteger(context, "vertical"); return openScreen(client -> new PaddingTestGui(hori, vert)).run(context); })))) - + .then(literal("#182").executes(openScreen(client -> new Issue182TestGui()))) )); } -- cgit