Fix tests

This commit is contained in:
Nassim Jahnke
2022-06-08 17:31:27 +02:00
parent f07398f8ae
commit ce4dbaa014
6 changed files with 31 additions and 29 deletions

View File

@@ -176,7 +176,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ public static final MaterialSetTag BUCKETS = new MaterialSetTag(keyFor("buckets")) + public static final MaterialSetTag BUCKETS = new MaterialSetTag(keyFor("buckets"))
+ .endsWith("BUCKET") + .endsWith("BUCKET")
+ .ensureSize("BUCKETS", 10).lock(); + .ensureSize("BUCKETS", 11).lock();
+ +
+ /** + /**
+ * Covers coal and charcoal. + * Covers coal and charcoal.
@@ -222,7 +222,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ public static final MaterialSetTag DOORS = new MaterialSetTag(keyFor("doors")) + public static final MaterialSetTag DOORS = new MaterialSetTag(keyFor("doors"))
+ .endsWith("_DOOR") + .endsWith("_DOOR")
+ .ensureSize("DOORS", 9).lock(); + .ensureSize("DOORS", 10).lock();
+ +
+ /** + /**
+ * Covers all dyes. + * Covers all dyes.
@@ -236,14 +236,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ public static final MaterialSetTag FENCE_GATES = new MaterialSetTag(keyFor("fence_gates")) + public static final MaterialSetTag FENCE_GATES = new MaterialSetTag(keyFor("fence_gates"))
+ .endsWith("_GATE") + .endsWith("_GATE")
+ .ensureSize("FENCE_GATES", 8).lock(); + .ensureSize("FENCE_GATES", 9).lock();
+ +
+ /** + /**
+ * Covers all variants of fences. + * Covers all variants of fences.
+ */ + */
+ public static final MaterialSetTag FENCES = new MaterialSetTag(keyFor("fences")) + public static final MaterialSetTag FENCES = new MaterialSetTag(keyFor("fences"))
+ .endsWith("_FENCE") + .endsWith("_FENCE")
+ .ensureSize("FENCES", 9).lock(); + .ensureSize("FENCES", 10).lock();
+ +
+ /** + /**
+ * Covers all variants of fish buckets. + * Covers all variants of fish buckets.
@@ -357,7 +357,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ public static final MaterialSetTag PRESSURE_PLATES = new MaterialSetTag(keyFor("pressure_plates")) + public static final MaterialSetTag PRESSURE_PLATES = new MaterialSetTag(keyFor("pressure_plates"))
+ .endsWith("_PRESSURE_PLATE") + .endsWith("_PRESSURE_PLATE")
+ .ensureSize("PRESSURE_PLATES", 12).lock(); + .ensureSize("PRESSURE_PLATES", 13).lock();
+ +
+ /** + /**
+ * Covers the variants of prismarine blocks. + * Covers the variants of prismarine blocks.
@@ -436,7 +436,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs")) + public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs"))
+ .endsWith("_SPAWN_EGG") + .endsWith("_SPAWN_EGG")
+ .ensureSize("SPAWN_EGGS", 67).lock(); + .ensureSize("SPAWN_EGGS", 71).lock();
+ +
+ /** + /**
+ * Covers all colors of stained glass. + * Covers all colors of stained glass.
@@ -457,7 +457,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ public static final MaterialSetTag TRAPDOORS = new MaterialSetTag(keyFor("trapdoors")) + public static final MaterialSetTag TRAPDOORS = new MaterialSetTag(keyFor("trapdoors"))
+ .endsWith("_TRAPDOOR") + .endsWith("_TRAPDOOR")
+ .ensureSize("TRAPDOORS", 9).lock(); + .ensureSize("TRAPDOORS", 10).lock();
+ +
+ /** + /**
+ * Covers all wood variants of doors. + * Covers all wood variants of doors.
@@ -465,7 +465,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static final MaterialSetTag WOODEN_DOORS = new MaterialSetTag(keyFor("wooden_doors")) + public static final MaterialSetTag WOODEN_DOORS = new MaterialSetTag(keyFor("wooden_doors"))
+ .endsWith("_DOOR") + .endsWith("_DOOR")
+ .not(Material.IRON_DOOR) + .not(Material.IRON_DOOR)
+ .ensureSize("WOODEN_DOORS", 8).lock(); + .ensureSize("WOODEN_DOORS", 9).lock();
+ +
+ /** + /**
+ * Covers all wood variants of fences. + * Covers all wood variants of fences.
@@ -473,7 +473,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static final MaterialSetTag WOODEN_FENCES = new MaterialSetTag(keyFor("wooden_fences")) + public static final MaterialSetTag WOODEN_FENCES = new MaterialSetTag(keyFor("wooden_fences"))
+ .endsWith("_FENCE") + .endsWith("_FENCE")
+ .not(Material.NETHER_BRICK_FENCE) + .not(Material.NETHER_BRICK_FENCE)
+ .ensureSize("WOODEN_FENCES", 8).lock(); + .ensureSize("WOODEN_FENCES", 9).lock();
+ +
+ /** + /**
+ * Covers all wood variants of trapdoors. + * Covers all wood variants of trapdoors.
@@ -481,14 +481,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public static final MaterialSetTag WOODEN_TRAPDOORS = new MaterialSetTag(keyFor("wooden_trapdoors")) + public static final MaterialSetTag WOODEN_TRAPDOORS = new MaterialSetTag(keyFor("wooden_trapdoors"))
+ .endsWith("_TRAPDOOR") + .endsWith("_TRAPDOOR")
+ .not(Material.IRON_TRAPDOOR) + .not(Material.IRON_TRAPDOOR)
+ .ensureSize("WOODEN_TRAPDOORS", 8).lock(); + .ensureSize("WOODEN_TRAPDOORS", 9).lock();
+ +
+ /** + /**
+ * Covers the wood variants of gates. + * Covers the wood variants of gates.
+ */ + */
+ public static final MaterialSetTag WOODEN_GATES = new MaterialSetTag(keyFor("wooden_gates")) + public static final MaterialSetTag WOODEN_GATES = new MaterialSetTag(keyFor("wooden_gates"))
+ .endsWith("_GATE") + .endsWith("_GATE")
+ .ensureSize("WOODEN_GATES", 8).lock(); + .ensureSize("WOODEN_GATES", 9).lock();
+ +
+ /** + /**
+ * Covers the variants of purpur. + * Covers the variants of purpur.
@@ -502,7 +502,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ public static final MaterialSetTag SIGNS = new MaterialSetTag(keyFor("signs")) + public static final MaterialSetTag SIGNS = new MaterialSetTag(keyFor("signs"))
+ .endsWith("_SIGN") + .endsWith("_SIGN")
+ .ensureSize("SIGNS", 16).lock(); + .ensureSize("SIGNS", 18).lock();
+ +
+ /** + /**
+ * Covers the variants of a regular torch. + * Covers the variants of a regular torch.

View File

@@ -34,9 +34,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ testCompileOnly(checkerQual) + testCompileOnly(checkerQual)
+ // Paper end + // Paper end
+ +
testImplementation("org.apache.commons:commons-lang3:3.12.0")
testImplementation("junit:junit:4.13.2") testImplementation("junit:junit:4.13.2")
testImplementation("org.hamcrest:hamcrest-library:1.3") testImplementation("org.hamcrest:hamcrest-library:1.3")
testImplementation("org.ow2.asm:asm-tree:9.3")
@@ -0,0 +0,0 @@ tasks.withType<Javadoc> { @@ -0,0 +0,0 @@ tasks.withType<Javadoc> {
options.links( options.links(
"https://guava.dev/releases/31.0.1-jre/api/docs/", "https://guava.dev/releases/31.0.1-jre/api/docs/",

View File

@@ -56,6 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ compileOnly(annotations) + compileOnly(annotations)
+ testCompileOnly(annotations) + testCompileOnly(annotations)
+ +
+ testImplementation("org.apache.commons:commons-lang3:3.12.0")
+ testImplementation("junit:junit:4.13.2") + testImplementation("junit:junit:4.13.2")
+ testImplementation("org.hamcrest:hamcrest-library:1.3") + testImplementation("org.hamcrest:hamcrest-library:1.3")
+ testImplementation("org.ow2.asm:asm-tree:9.3") + testImplementation("org.ow2.asm:asm-tree:9.3")

View File

@@ -138,7 +138,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+import io.papermc.paper.adventure.PaperAdventure; +import io.papermc.paper.adventure.PaperAdventure;
+import net.kyori.adventure.text.format.TextColor; +import net.kyori.adventure.text.format.TextColor;
+import net.minecraft.advancements.FrameType; +import net.minecraft.advancements.FrameType;
+import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.network.chat.contents.TranslatableContents;
+import org.junit.Test; +import org.junit.Test;
+ +
+import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertEquals;
@@ -149,7 +149,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public void test() { + public void test() {
+ for (FrameType nmsFrameType : FrameType.values()) { + for (FrameType nmsFrameType : FrameType.values()) {
+ final TextColor expectedColor = PaperAdventure.asAdventure(nmsFrameType.getChatColor()); + final TextColor expectedColor = PaperAdventure.asAdventure(nmsFrameType.getChatColor());
+ final String expectedTranslationKey = ((TranslatableComponent) nmsFrameType.getDisplayName()).getKey(); + final String expectedTranslationKey = ((TranslatableContents) nmsFrameType.getDisplayName().getContents()).getKey();
+ final var frame = PaperAdvancementDisplay.asPaperFrame(nmsFrameType); + final var frame = PaperAdvancementDisplay.asPaperFrame(nmsFrameType);
+ assertEquals("The translation keys should be the same", expectedTranslationKey, frame.translationKey()); + assertEquals("The translation keys should be the same", expectedTranslationKey, frame.translationKey());
+ assertEquals("The frame colors should be the same", expectedColor, frame.color()); + assertEquals("The frame colors should be the same", expectedColor, frame.color());

View File

@@ -80,9 +80,11 @@ diff --git a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java b/src/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java --- a/src/test/java/io/papermc/paper/world/TranslationKeyTest.java
+++ b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java +++ b/src/test/java/io/papermc/paper/world/TranslationKeyTest.java
@@ -0,0 +0,0 @@ package io.papermc.paper.world; @@ -0,0 +0,0 @@
package io.papermc.paper.world;
import com.destroystokyo.paper.ClientOption; import com.destroystokyo.paper.ClientOption;
import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.network.chat.contents.TranslatableContents;
import net.minecraft.world.entity.player.ChatVisiblity; import net.minecraft.world.entity.player.ChatVisiblity;
+import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.CreativeModeTab;
+import net.minecraft.world.level.GameType; +import net.minecraft.world.level.GameType;
@@ -112,7 +114,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Test + @Test
+ public void testDifficultyKeys() { + public void testDifficultyKeys() {
+ for (Difficulty bukkitDifficulty : Difficulty.values()) { + for (Difficulty bukkitDifficulty : Difficulty.values()) {
+ Assert.assertEquals(bukkitDifficulty + "'s translation key doesn't match", ((TranslatableComponent) net.minecraft.world.Difficulty.byId(bukkitDifficulty.ordinal()).getDisplayName()).getKey(), bukkitDifficulty.translationKey()); + Assert.assertEquals(bukkitDifficulty + "'s translation key doesn't match", ((TranslatableContents) net.minecraft.world.Difficulty.byId(bukkitDifficulty.ordinal()).getDisplayName().getContents()).getKey(), bukkitDifficulty.translationKey());
+ } + }
+ } + }
+ +
@@ -144,7 +146,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ continue; + continue;
+ } + }
+ CreativeCategory category = Objects.requireNonNull(CraftCreativeCategory.fromNMS(tab)); + CreativeCategory category = Objects.requireNonNull(CraftCreativeCategory.fromNMS(tab));
+ Assert.assertEquals("translation key mismatch for " + category, ((TranslatableComponent) tab.getDisplayName()).getKey(), category.translationKey()); + Assert.assertEquals("translation key mismatch for " + category, ((TranslatableContents) tab.getDisplayName().getContents()).getKey(), category.translationKey());
+ } + }
+ } + }
+ +
@@ -153,7 +155,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ for (GameType nms : GameType.values()) { + for (GameType nms : GameType.values()) {
+ GameMode bukkit = GameMode.getByValue(nms.getId()); + GameMode bukkit = GameMode.getByValue(nms.getId());
+ Assert.assertNotNull(bukkit); + Assert.assertNotNull(bukkit);
+ Assert.assertEquals("translation key mismatch for " + bukkit, ((TranslatableComponent) nms.getLongDisplayName()).getKey(), bukkit.translationKey()); + Assert.assertEquals("translation key mismatch for " + bukkit, ((TranslatableContents) nms.getLongDisplayName().getContents()).getKey(), bukkit.translationKey());
+ } + }
+ } + }
} }

View File

@@ -134,7 +134,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+package io.papermc.paper.world; +package io.papermc.paper.world;
+ +
+import com.destroystokyo.paper.ClientOption; +import com.destroystokyo.paper.ClientOption;
+import net.minecraft.network.chat.TranslatableComponent;
+import net.minecraft.world.entity.player.ChatVisiblity; +import net.minecraft.world.entity.player.ChatVisiblity;
+import org.bukkit.Difficulty; +import org.bukkit.Difficulty;
+import org.junit.Assert; +import org.junit.Assert;