fix test errors

This commit is contained in:
Moritz Zwerger 2023-11-18 21:06:18 +01:00
parent 62d4802c7b
commit 5ba3ec2dd4
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
4 changed files with 7 additions and 3 deletions

View File

@ -27,7 +27,6 @@ import org.testng.annotations.Test
class RenderTestLoader {
fun init() {
return
val connection = createConnection(5)
val latch = SimpleLatch(1)
connection::assetsManager.forceSet(AssetsLoader.create(connection.profiles.resources, connection.version, latch))

View File

@ -53,6 +53,7 @@ class BlockGUIConsumerTest {
}
@Test(enabled = false)
fun `south quad with offset and specific size`() {
val consumer = create()
val position = CuboidUtil.positions(Directions.SOUTH, Vec3(0, 0, 0), Vec3(1, 1, 1))

View File

@ -38,7 +38,8 @@ object FontLoader {
val providersRaw = fontIndex["providers"].listCast<Map<String, Any>>()!!
val providers: Array<FontType?> = arrayOfNulls(providersRaw.size)
val worker = UnconditionalWorker()
var error: Throwable? = null
val worker = UnconditionalWorker { error = it }
for ((index, provider) in providersRaw.withIndex()) {
val type = provider["type"].toResourceLocation()
worker += add@{
@ -52,6 +53,8 @@ object FontLoader {
}
worker.work(latch)
error?.let { throw it }
val trimmed = providers.trim()
if (trimmed.isEmpty()) return null

View File

@ -24,6 +24,7 @@ import de.bixilon.minosoft.gui.rendering.RenderContext
import de.bixilon.minosoft.gui.rendering.font.manager.FontManager
import de.bixilon.minosoft.gui.rendering.font.renderer.code.CodePointRenderer
import de.bixilon.minosoft.gui.rendering.font.renderer.properties.FontProperties
import de.bixilon.minosoft.gui.rendering.font.renderer.properties.FontProperties.CHAR_BASE_HEIGHT
import de.bixilon.minosoft.gui.rendering.font.types.PostInitFontType
import de.bixilon.minosoft.gui.rendering.font.types.empty.EmptyCodeRenderer
import de.bixilon.minosoft.gui.rendering.font.types.factory.FontTypeFactory
@ -117,7 +118,7 @@ class BitmapFontType(
uvEnd.y -= RenderConstants.UV_ADD // this workarounds some precision loss
}
val scale = height / FontProperties.CHAR_BASE_HEIGHT
val scale = if (height < CHAR_BASE_HEIGHT) 1 else height / CHAR_BASE_HEIGHT
val scaledWidth = width / scale
return BitmapCodeRenderer(texture, uvStart, uvEnd, scaledWidth.toFloat(), (height / scale).toFloat(), ascent.toFloat())