more arch on testing extensions
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-09-04 00:43:10 -04:00
parent 56b60695c5
commit a95086e6db
2 changed files with 33 additions and 1 deletions

View File

@ -19,7 +19,7 @@ public class EntityExtension implements BeforeEachCallback, AfterEachCallback {
TestEngineUtils.initGraphicalEngine();
//load scene
EngineInit.setupConnectedTestScene();
EngineInit.setupConnectedTestViewport();
}
@Override

View File

@ -15,6 +15,38 @@ public class EngineInit {
* Setups up a locally-connected client and server that have loaded a test scene
*/
public static void setupConnectedTestScene(){
//
//load the scene
LoadingThread loadingThread = new LoadingThread(LoadingThreadType.LEVEL,"testscene1");
Globals.threadManager.start(loadingThread);
//
//wait for client to be fully init'd
int frames = 0;
while(Globals.threadManager.isLoading()){
TestEngineUtils.simulateFrames(1);
try {
TimeUnit.MILLISECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
frames++;
if(frames > MAX_FRAMES_TO_WAIT){
String errorMessage = "Failed to setup connected test scene!\n" +
"Still running threads are:\n"
;
for(LoadingThread thread : Globals.threadManager.getLoadingThreads()){
errorMessage = errorMessage + thread.getType() + "\n";
}
throw new IllegalStateException(errorMessage);
}
}
}
/**
* Setups up a locally-connected client and server that have loaded the viewport
*/
public static void setupConnectedTestViewport(){
//
//load the scene
LoadingThread loadingThread = new LoadingThread(LoadingThreadType.LOAD_VIEWPORT);