This commit is contained in:
Jason Mitchell authored and GitHub committed 2026-05-27 18:41:41 -07:00
1 parent d3cea1bfe4
commit 5dc4f1fab8
4 files changed
+33 -9

No files matched your search

+5
View File
@@ -1,9 +1,14 @@
import xyz.wagyourtail.jvmdg.gradle.flags.DowngradeFlags
import xyz.wagyourtail.jvmdg.gradle.task.DowngradeJar
import xyz.wagyourtail.jvmdg.gradle.task.files.DowngradeFiles
plugins {
id("com.gtnewhorizons.gtnhconvention")
}
tasks.withType<DowngradeJar>().configureEach { logLevel.set("FATAL") }
tasks.withType<DowngradeFiles>().configureEach { logLevel.set("FATAL") }
minecraft {
extraRunJvmArguments.add("-Dangelica.enableTestBlocks=true")
extraRunJvmArguments.add("-Dangelica.dumpClass=true")
+15
View File
@@ -124,6 +124,7 @@ tasks.withType<DowngradeFiles>().configureEach {
downgradeTo.set(JavaVersion.VERSION_1_8)
multiReleaseOriginal.set(false)
multiReleaseVersions.set(emptySet())
logLevel.set("FATAL")
}
val downgradeDepsForTest by tasks.registering(DowngradeFiles::class) {
@@ -139,6 +140,7 @@ val downgradeMainClasses by tasks.registering(DowngradeFiles::class) {
val downgradeTestClasses by tasks.registering(DowngradeFiles::class) {
inputCollection = sourceSets["test"].output.classesDirs
classpath = sourceSets["test"].compileClasspath
sourceSets["test"].output.classesDirs.files.forEach { outputs.dir(temporaryDir.resolve(it.name)) }
dependsOn(tasks.named("testClasses"))
}
@@ -174,6 +176,19 @@ tasks.test {
jvmArgs("-Djava.library.path=${extractNatives.get().property("destinationFolder").let { (it as DirectoryProperty).asFile.get().path }}")
}
val verifyTestsRan by tasks.registering {
val resultsDir = layout.buildDirectory.dir("test-results/test")
dependsOn(tasks.test)
doLast {
val dir = resultsDir.get().asFile
val xmls = dir.listFiles { f -> f.name.startsWith("TEST-") && f.name.endsWith(".xml") } ?: emptyArray()
check(xmls.isNotEmpty()) {
":glsm:test produced no TEST-*.xml in $dir - test task likely went NO-SOURCE"
}
}
}
tasks.check { dependsOn(verifyTestsRan) }
publishing {
publications {
create<MavenPublication>("mavenJava") {
@@ -45,9 +45,9 @@ public class GLSM_TextureInfoCache_UnitTest {
void testNonGenericUploadCachesWithoutRoundtrip() {
int texId = GL11.glGenTextures();
try {
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texId);
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, texId);
ByteBuffer pixels = BufferUtils.createByteBuffer(64 * 64 * 4);
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, 64, 64, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, pixels);
GLStateManager.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, 64, 64, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, pixels);
TextureInfo info = TextureInfoCache.INSTANCE.getInfo(texId);
assertFalse(info.needsInternalFormatResolve());
@@ -63,9 +63,9 @@ public class GLSM_TextureInfoCache_UnitTest {
void testGenericCompressedPreservesAsPassedInternalFormat() {
int texId = GL11.glGenTextures();
try {
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texId);
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, texId);
ByteBuffer pixels = BufferUtils.createByteBuffer(64 * 64 * 4);
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL13.GL_COMPRESSED_RGBA, 64, 64, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, pixels);
GLStateManager.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL13.GL_COMPRESSED_RGBA, 64, 64, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, pixels);
TextureInfo info = TextureInfoCache.INSTANCE.getInfo(texId);
assertEquals(GL13.GL_COMPRESSED_RGBA, info.getInternalFormat());
@@ -80,15 +80,15 @@ public class GLSM_TextureInfoCache_UnitTest {
void testRepeatedQueryAfterResolveUsesCache() {
int texId = GL11.glGenTextures();
try {
GL11.glBindTexture(GL11.GL_TEXTURE_2D, texId);
GLStateManager.glBindTexture(GL11.GL_TEXTURE_2D, texId);
ByteBuffer pixels = BufferUtils.createByteBuffer(64 * 64 * 4);
GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL13.GL_COMPRESSED_RGBA, 64, 64, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, pixels);
GLStateManager.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL13.GL_COMPRESSED_RGBA, 64, 64, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, pixels);
TextureInfo info = TextureInfoCache.INSTANCE.getInfo(texId);
assertTrue(info.needsInternalFormatResolve());
int first = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_INTERNAL_FORMAT);
int first = GLStateManager.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_INTERNAL_FORMAT);
assertFalse(info.needsInternalFormatResolve());
int second = GL11.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_INTERNAL_FORMAT);
int second = GLStateManager.glGetTexLevelParameteri(GL11.GL_TEXTURE_2D, 0, GL11.GL_TEXTURE_INTERNAL_FORMAT);
assertEquals(first, second);
} finally {
GL11.glDeleteTextures(texId);
@@ -21,6 +21,8 @@ class SharedDrawableVaoTest {
private static final String VERT_330 = "#version 330 core\nvoid main() { gl_Position = vec4(0.0); }\n";
private static final String FRAG_330 = "#version 330 core\nout vec4 o;\nvoid main() { o = vec4(0.0); }\n";
private static boolean ownsDisplay = false;
@BeforeAll
static void createContext() throws LWJGLException {
assumeTrue(!Display.isCreated(), "inherited Display -- skipping to avoid profile drift");
@@ -31,11 +33,13 @@ class SharedDrawableVaoTest {
new PixelFormat().withDepthBits(24).withStencilBits(8),
new ContextAttribs(4, 1).withProfileCore(true).withForwardCompatible(true));
GL30.glBindVertexArray(GL30.glGenVertexArrays());
ownsDisplay = true;
}
@AfterAll
static void destroyContext() {
if (Display.isCreated()) Display.destroy();
if (ownsDisplay && Display.isCreated()) Display.destroy();
ownsDisplay = false;
}
@Test