mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-19 03:49:05 +00:00
test: characterize multipart render ID
This commit is contained in:
1 parent
542e910faf
commit
3c22ab69f0
2 files changed
+48
No files matched your search
@@ -60,6 +60,19 @@ import scala.collection.immutable.Nil$;
|
||||
|
||||
class ForgeEnvironmentSmokeTest {
|
||||
|
||||
@Test
|
||||
void renderIdRemainsUninitializedOnTheDedicatedServerAndSharesBlockState() {
|
||||
int previous = TileMultipart.renderID();
|
||||
assertEquals(-1, previous);
|
||||
try {
|
||||
TileMultipart.renderID_$eq(37);
|
||||
assertEquals(37, codechicken.multipart.handler.MultipartProxy.block().getRenderType());
|
||||
assertEquals(37, codechicken.multipart.TileMultipart$.MODULE$.renderID());
|
||||
} finally {
|
||||
TileMultipart.renderID_$eq(previous);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void reachesServerStartedWithWorldAndMultipartModsLoaded() {
|
||||
assertTrue(ForgeMultipartFunctionalTestMod.preInitialized);
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package codechicken.multipart;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class TileMultipartRenderIdTest {
|
||||
|
||||
@Test
|
||||
void uninitializedRenderIdIsTheSharedMinusOneSentinel() {
|
||||
assertEquals(-1, TileMultipart.renderID());
|
||||
assertEquals(-1, TileMultipart$.MODULE$.renderID());
|
||||
assertEquals(-1, new BlockMultipart().getRenderType());
|
||||
}
|
||||
|
||||
@Test
|
||||
void bothLegacySettersUpdateOneGlobalValueWithoutValidation() {
|
||||
int previous = TileMultipart.renderID();
|
||||
BlockMultipart first = new BlockMultipart();
|
||||
BlockMultipart second = new BlockMultipart();
|
||||
try {
|
||||
for (int value : new int[] { 0, 37, -1, Integer.MIN_VALUE, Integer.MAX_VALUE }) {
|
||||
TileMultipart.renderID_$eq(value);
|
||||
assertEquals(value, TileMultipart$.MODULE$.renderID());
|
||||
assertEquals(value, first.getRenderType());
|
||||
TileMultipart$.MODULE$.renderID_$eq(~value);
|
||||
assertEquals(~value, TileMultipart.renderID());
|
||||
assertEquals(~value, first.getRenderType());
|
||||
assertEquals(~value, second.getRenderType());
|
||||
}
|
||||
} finally {
|
||||
TileMultipart.renderID_$eq(previous);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user