1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-04 23:53:01 +00:00

Fix printouts crashing in item frames

This commit is contained in:
Jonathan Coates
2023-01-09 18:28:44 +00:00
parent cdc91a8e5d
commit 2457a31728
7 changed files with 203 additions and 146 deletions

View File

@@ -63,7 +63,7 @@ class Monitor_Test {
}
/**
* Test
* Test monitors render correctly
*/
@GameTestGenerator
fun Render_monitor_tests(): List<TestFunction> {
@@ -72,7 +72,7 @@ class Monitor_Test {
fun addTest(label: String, renderer: MonitorRenderer, time: Long = Times.NOON, tag: String = TestTags.CLIENT) {
if (!TestTags.isEnabled(tag)) return
val className = Monitor_Test::class.java.simpleName.lowercase()
val className = this::class.java.simpleName.lowercase()
val testName = "$className.render_monitor"
tests.add(

View File

@@ -0,0 +1,53 @@
package dan200.computercraft.gametest
import dan200.computercraft.gametest.api.*
import net.minecraft.gametest.framework.GameTestGenerator
import net.minecraft.gametest.framework.GameTestHelper
import net.minecraft.gametest.framework.TestFunction
class Printout_Test {
/**
* Test printouts render correctly
*/
@GameTestGenerator
fun Render_in_frame(): List<TestFunction> {
val tests = mutableListOf<TestFunction>()
fun addTest(label: String, time: Long = Times.NOON, tag: String = TestTags.CLIENT) {
if (!TestTags.isEnabled(tag)) return
val className = this::class.java.simpleName.lowercase()
val testName = "$className.render_in_frame"
tests.add(
TestFunction(
"$testName.$label",
"$testName.$label",
testName,
Timeouts.DEFAULT,
0,
true,
) { renderPrintout(it, time) },
)
}
addTest("noon", Times.NOON)
addTest("midnight", Times.MIDNIGHT)
addTest("sodium", tag = "sodium")
addTest("iris_noon", Times.NOON, tag = "iris")
addTest("iris_midnight", Times.MIDNIGHT, tag = "iris")
return tests
}
private fun renderPrintout(helper: GameTestHelper, time: Long) = helper.sequence {
thenExecute {
helper.level.dayTime = time
helper.positionAtArmorStand()
}
thenScreenshot()
}
}

View File

@@ -80,6 +80,7 @@ object TestHooks {
Monitor_Test::class.java,
Pocket_Computer_Test::class.java,
Printer_Test::class.java,
Printout_Test::class.java,
Recipe_Test::class.java,
Turtle_Test::class.java,
)