From 7e616b6d2826ddb8ebd6a658e61b80b05b121d96 Mon Sep 17 00:00:00 2001 From: Bixilon Date: Mon, 17 Oct 2022 09:49:41 +0200 Subject: [PATCH] wip integration testing --- pom.xml | 37 +++++++++++++++++++ .../de/bixilon/minosoft/setup/MinosoftSIT.kt | 30 +++++++++++++++ .../data/registries/versions/VersionsSIT.kt | 28 ++++++++++++++ .../data/registries/versions/VersionsIT.kt | 27 ++++++++++++++ .../preparer/cull/SolidCullSectionPreparer.kt | 2 +- 5 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 src/integreation-test/kotlin/de/bixilon/minosoft/setup/MinosoftSIT.kt create mode 100644 src/integreation-test/kotlin/de/bixilon/minosoft/setup/data/registries/versions/VersionsSIT.kt create mode 100644 src/integreation-test/kotlin/de/bixilon/minosoft/test/data/registries/versions/VersionsIT.kt diff --git a/pom.xml b/pom.xml index 69acf948a..b6623d03c 100644 --- a/pom.xml +++ b/pom.xml @@ -42,6 +42,10 @@ ${maven.compiler.target} + + ${project.basedir}/src/test/java + ${project.basedir}/src/integration-test/kotlin + @@ -139,6 +143,39 @@ maven-surefire-report-plugin 2.22.2 + + org.apache.maven.plugins + maven-failsafe-plugin + 2.22.1 + + + pre-integration-tests + pre-integration-test + + + de/bixilon/minosoft/setup/** + + + + pre-integration-tests + + + + integration-tests + integration-test + + + + de/bixilon/minosoft/test/** + + + + + integration-tests + + + + diff --git a/src/integreation-test/kotlin/de/bixilon/minosoft/setup/MinosoftSIT.kt b/src/integreation-test/kotlin/de/bixilon/minosoft/setup/MinosoftSIT.kt new file mode 100644 index 000000000..246f0b5bd --- /dev/null +++ b/src/integreation-test/kotlin/de/bixilon/minosoft/setup/MinosoftSIT.kt @@ -0,0 +1,30 @@ +/* + * Minosoft + * Copyright (C) 2020-2022 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.setup + +import de.bixilon.kutil.latch.CountUpAndDownLatch +import de.bixilon.minosoft.Minosoft +import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Order +import org.junit.jupiter.api.Test + +internal class MinosoftSIT { + + @Test + @Order(1) + fun initAssetsManager() { + Minosoft.MINOSOFT_ASSETS_MANAGER.load(CountUpAndDownLatch(0)) + print("Initialized assets manager") + } +} diff --git a/src/integreation-test/kotlin/de/bixilon/minosoft/setup/data/registries/versions/VersionsSIT.kt b/src/integreation-test/kotlin/de/bixilon/minosoft/setup/data/registries/versions/VersionsSIT.kt new file mode 100644 index 000000000..d306e17bf --- /dev/null +++ b/src/integreation-test/kotlin/de/bixilon/minosoft/setup/data/registries/versions/VersionsSIT.kt @@ -0,0 +1,28 @@ +/* + * Minosoft + * Copyright (C) 2020-2022 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.setup.data.registries.versions + +import de.bixilon.kutil.latch.CountUpAndDownLatch +import de.bixilon.minosoft.data.registries.versions.Versions +import org.junit.jupiter.api.Order +import org.junit.jupiter.api.Test + +internal class VersionsSIT { + + @Test + @Order(2) + fun loadVersionsJson() { + Versions.load(CountUpAndDownLatch(0)) + } +} diff --git a/src/integreation-test/kotlin/de/bixilon/minosoft/test/data/registries/versions/VersionsIT.kt b/src/integreation-test/kotlin/de/bixilon/minosoft/test/data/registries/versions/VersionsIT.kt new file mode 100644 index 000000000..0118d8356 --- /dev/null +++ b/src/integreation-test/kotlin/de/bixilon/minosoft/test/data/registries/versions/VersionsIT.kt @@ -0,0 +1,27 @@ +/* + * Minosoft + * Copyright (C) 2020-2022 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.test.data.registries.versions + +import de.bixilon.minosoft.data.registries.versions.Versions +import de.bixilon.minosoft.protocol.protocol.ProtocolVersions +import org.junit.jupiter.api.Test +import kotlin.test.assertEquals + +internal class VersionsIT { + + @Test + fun test1_17() { + assertEquals(ProtocolVersions.V_1_17_1, Versions["1.17.1"]!!.versionId) + } +} diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/world/preparer/cull/SolidCullSectionPreparer.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/world/preparer/cull/SolidCullSectionPreparer.kt index 004cf17ac..227b3a3bf 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/world/preparer/cull/SolidCullSectionPreparer.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/world/preparer/cull/SolidCullSectionPreparer.kt @@ -213,7 +213,7 @@ class SolidCullSectionPreparer( val neighbourIndex = y shl 8 or heightmapIndex neighbourBlocks[ordinal] = section?.blocks?.unsafeGet(neighbourIndex) light[ordinal] = section?.light?.get(neighbourIndex) ?: 0x00 - if (position.y > chunk.light.heightmap[heightmapIndex]) { + if (position.y >= chunk.light.heightmap[heightmapIndex]) { light[ordinal] = (light[ordinal].toInt() or SectionLight.SKY_LIGHT_MASK).toByte() // set sky light to 0x0F } }