diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/breaking/block/BlockLightBreakIT.kt b/src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/breaking/BlockLightBreakIT.kt similarity index 94% rename from src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/breaking/block/BlockLightBreakIT.kt rename to src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/breaking/BlockLightBreakIT.kt index 9a00a5995..81d9eb2a1 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/breaking/block/BlockLightBreakIT.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/breaking/BlockLightBreakIT.kt @@ -11,7 +11,7 @@ * This software is not affiliated with Mojang AB, the original developer of Minecraft. */ -package de.bixilon.minosoft.data.world.chunk.light.breaking.block +package de.bixilon.minosoft.data.world.chunk.light.breaking import de.bixilon.kotlinglm.vec2.Vec2i import de.bixilon.kotlinglm.vec3.Vec3i @@ -123,6 +123,20 @@ class BlockLightBreakIT { world.assertLight(17, 17, 16, 0xF0) } + fun lowerSection() { + val world = ConnectionTestUtil.createConnection(3, light = true).world + world[Vec3i(8, 16, 8)] = TorchTest0.state + world[Vec3i(8, 16, 8)] = null + world.assertLight(8, 15, 8, 0xF0) + } + + fun upperSection() { + val world = ConnectionTestUtil.createConnection(3, light = true).world + world[Vec3i(8, 15, 8)] = TorchTest0.state + world[Vec3i(8, 15, 8)] = null + world.assertLight(8, 16, 8, 0xF0) + } + fun totalPropagation1() { val world = ConnectionTestUtil.createConnection(3, light = true).world world[Vec3i(12, 20, 12)] = TorchTest0.state diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/place/block/BlockLightPlaceIT.kt b/src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/place/BlockLightPlaceIT.kt similarity index 95% rename from src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/place/block/BlockLightPlaceIT.kt rename to src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/place/BlockLightPlaceIT.kt index ea3aee5d6..de19aa82e 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/place/block/BlockLightPlaceIT.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/place/BlockLightPlaceIT.kt @@ -11,7 +11,7 @@ * This software is not affiliated with Mojang AB, the original developer of Minecraft. */ -package de.bixilon.minosoft.data.world.chunk.light.place.block +package de.bixilon.minosoft.data.world.chunk.light.place import de.bixilon.kotlinglm.vec2.Vec2i import de.bixilon.kotlinglm.vec3.Vec3i @@ -110,6 +110,18 @@ class BlockLightPlaceIT { world.assertLight(17, 17, 16, 0xFD) } + fun lowerSection() { + val world = ConnectionTestUtil.createConnection(3, light = true).world + world[Vec3i(8, 16, 8)] = TorchTest0.state + world.assertLight(8, 15, 8, 0xFD) + } + + fun upperSection() { + val world = ConnectionTestUtil.createConnection(3, light = true).world + world[Vec3i(8, 15, 8)] = TorchTest0.state + world.assertLight(8, 16, 8, 0xFD) + } + fun totalPropagation1() { val world = ConnectionTestUtil.createConnection(3, light = true).world world[Vec3i(12, 20, 12)] = TorchTest0.state diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/place/SkyLightPlaceIT.kt b/src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/place/SkyLightPlaceIT.kt new file mode 100644 index 000000000..790703632 --- /dev/null +++ b/src/integration-test/kotlin/de/bixilon/minosoft/data/world/chunk/light/place/SkyLightPlaceIT.kt @@ -0,0 +1,56 @@ +/* + * Minosoft + * Copyright (C) 2020-2023 Moritz Zwerger + * + * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program. If not, see . + * + * This software is not affiliated with Mojang AB, the original developer of Minecraft. + */ + +package de.bixilon.minosoft.data.world.chunk.light.place + +import de.bixilon.kotlinglm.vec3.Vec3i +import de.bixilon.minosoft.data.registries.blocks.SlimeTest0 +import de.bixilon.minosoft.data.registries.blocks.types.stone.StoneTest0 +import de.bixilon.minosoft.data.world.chunk.light.LightTestUtil.assertLight +import de.bixilon.minosoft.protocol.network.connection.play.ConnectionTestUtil.createConnection +import org.testng.annotations.Test + + +@Test(groups = ["light"], dependsOnGroups = ["block"], threadPoolSize = 8, priority = -100) +class SkyLightPlaceIT { + + fun aboveBlock() { + val world = createConnection(3, light = true).world + world[Vec3i(8, 10, 8)] = StoneTest0.state + world.assertLight(8, 11, 8, 0xF0) + } + + fun inBlock() { + val world = createConnection(3, light = true).world + world[Vec3i(8, 10, 8)] = StoneTest0.state + world.assertLight(8, 10, 8, 0x00) + } + + fun belowBlock() { + val world = createConnection(3, light = true).world + world[Vec3i(8, 10, 8)] = StoneTest0.state + world.assertLight(8, 9, 8, 0xE0) + } + + fun filteredInBlock() { + val world = createConnection(3, light = true).world + world[Vec3i(8, 10, 8)] = SlimeTest0.state + world.assertLight(8, 10, 8, 0xE0) + } + + fun belowSection() { + val world = createConnection(3, light = true).world + world[Vec3i(8, 16, 8)] = StoneTest0.state + world.assertLight(8, 15, 8, 0xE0) + } +} diff --git a/src/integration-test/kotlin/de/bixilon/minosoft/input/interaction/use/UseHandlerInputTest.kt b/src/integration-test/kotlin/de/bixilon/minosoft/input/interaction/use/UseHandlerInputTest.kt index 61efc0a21..ef18f4ce4 100644 --- a/src/integration-test/kotlin/de/bixilon/minosoft/input/interaction/use/UseHandlerInputTest.kt +++ b/src/integration-test/kotlin/de/bixilon/minosoft/input/interaction/use/UseHandlerInputTest.kt @@ -25,7 +25,9 @@ import de.bixilon.minosoft.protocol.packets.c2s.play.PlayerActionC2SP import de.bixilon.minosoft.protocol.packets.c2s.play.item.UseItemC2SP import de.bixilon.minosoft.protocol.packets.c2s.play.move.PositionRotationC2SP import de.bixilon.minosoft.protocol.packets.c2s.play.move.SwingArmC2SP +import org.testng.SkipException import org.testng.annotations.Test +import kotlin.system.measureTimeMillis @Test(groups = ["interaction"], dependsOnGroups = ["item"]) class UseHandlerInputTest { @@ -54,7 +56,7 @@ class UseHandlerInputTest { connection.assertPacket(PositionRotationC2SP::class.java) connection.assertPacket(UseItemC2SP::class.java) connection.assertPacket(SwingArmC2SP::class.java) - Thread.sleep(4 * 50 + 10) + if (measureTimeMillis { Thread.sleep(4 * 50 + 10) } > 4 * 50 + 30) throw SkipException("busy") connection.assertPacket(PositionRotationC2SP::class.java) connection.assertPacket(UseItemC2SP::class.java) connection.assertPacket(SwingArmC2SP::class.java) @@ -71,7 +73,7 @@ class UseHandlerInputTest { handler.press() connection.assertPacket(PositionRotationC2SP::class.java) connection.assertPacket(UseItemC2SP::class.java) - Thread.sleep(55) + if (measureTimeMillis { Thread.sleep(55) } > 80) throw SkipException("busy") connection.assertNoPacket() handler.release() connection.assertPacket(PlayerActionC2SP::class.java)