mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 02:45:13 -04:00
sky light place tests
This commit is contained in:
parent
dc1c425b3e
commit
2dd11e083f
@ -11,7 +11,7 @@
|
|||||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
* 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.vec2.Vec2i
|
||||||
import de.bixilon.kotlinglm.vec3.Vec3i
|
import de.bixilon.kotlinglm.vec3.Vec3i
|
||||||
@ -123,6 +123,20 @@ class BlockLightBreakIT {
|
|||||||
world.assertLight(17, 17, 16, 0xF0)
|
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() {
|
fun totalPropagation1() {
|
||||||
val world = ConnectionTestUtil.createConnection(3, light = true).world
|
val world = ConnectionTestUtil.createConnection(3, light = true).world
|
||||||
world[Vec3i(12, 20, 12)] = TorchTest0.state
|
world[Vec3i(12, 20, 12)] = TorchTest0.state
|
@ -11,7 +11,7 @@
|
|||||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
* 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.vec2.Vec2i
|
||||||
import de.bixilon.kotlinglm.vec3.Vec3i
|
import de.bixilon.kotlinglm.vec3.Vec3i
|
||||||
@ -110,6 +110,18 @@ class BlockLightPlaceIT {
|
|||||||
world.assertLight(17, 17, 16, 0xFD)
|
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() {
|
fun totalPropagation1() {
|
||||||
val world = ConnectionTestUtil.createConnection(3, light = true).world
|
val world = ConnectionTestUtil.createConnection(3, light = true).world
|
||||||
world[Vec3i(12, 20, 12)] = TorchTest0.state
|
world[Vec3i(12, 20, 12)] = TorchTest0.state
|
@ -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 <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* 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)
|
||||||
|
}
|
||||||
|
}
|
@ -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.item.UseItemC2SP
|
||||||
import de.bixilon.minosoft.protocol.packets.c2s.play.move.PositionRotationC2SP
|
import de.bixilon.minosoft.protocol.packets.c2s.play.move.PositionRotationC2SP
|
||||||
import de.bixilon.minosoft.protocol.packets.c2s.play.move.SwingArmC2SP
|
import de.bixilon.minosoft.protocol.packets.c2s.play.move.SwingArmC2SP
|
||||||
|
import org.testng.SkipException
|
||||||
import org.testng.annotations.Test
|
import org.testng.annotations.Test
|
||||||
|
import kotlin.system.measureTimeMillis
|
||||||
|
|
||||||
@Test(groups = ["interaction"], dependsOnGroups = ["item"])
|
@Test(groups = ["interaction"], dependsOnGroups = ["item"])
|
||||||
class UseHandlerInputTest {
|
class UseHandlerInputTest {
|
||||||
@ -54,7 +56,7 @@ class UseHandlerInputTest {
|
|||||||
connection.assertPacket(PositionRotationC2SP::class.java)
|
connection.assertPacket(PositionRotationC2SP::class.java)
|
||||||
connection.assertPacket(UseItemC2SP::class.java)
|
connection.assertPacket(UseItemC2SP::class.java)
|
||||||
connection.assertPacket(SwingArmC2SP::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(PositionRotationC2SP::class.java)
|
||||||
connection.assertPacket(UseItemC2SP::class.java)
|
connection.assertPacket(UseItemC2SP::class.java)
|
||||||
connection.assertPacket(SwingArmC2SP::class.java)
|
connection.assertPacket(SwingArmC2SP::class.java)
|
||||||
@ -71,7 +73,7 @@ class UseHandlerInputTest {
|
|||||||
handler.press()
|
handler.press()
|
||||||
connection.assertPacket(PositionRotationC2SP::class.java)
|
connection.assertPacket(PositionRotationC2SP::class.java)
|
||||||
connection.assertPacket(UseItemC2SP::class.java)
|
connection.assertPacket(UseItemC2SP::class.java)
|
||||||
Thread.sleep(55)
|
if (measureTimeMillis { Thread.sleep(55) } > 80) throw SkipException("busy")
|
||||||
connection.assertNoPacket()
|
connection.assertNoPacket()
|
||||||
handler.release()
|
handler.release()
|
||||||
connection.assertPacket(PlayerActionC2SP::class.java)
|
connection.assertPacket(PlayerActionC2SP::class.java)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user