entity-scene testing tools
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				studiorailgun/Renderer/pipeline/head This commit looks good
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	studiorailgun/Renderer/pipeline/head This commit looks good
				
			This commit is contained in:
		
							parent
							
								
									6dc82d0b5e
								
							
						
					
					
						commit
						ea0902d22f
					
				| @ -1,6 +1,8 @@ | |||||||
| package electrosphere.game.data.item.type.model; | package electrosphere.game.data.item.type.model; | ||||||
| 
 | 
 | ||||||
| import electrosphere.game.data.item.type.Item; | import electrosphere.game.data.item.type.Item; | ||||||
|  | import electrosphere.logger.LoggerInterface; | ||||||
|  | 
 | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| public class ItemTypeMap { | public class ItemTypeMap { | ||||||
| @ -16,6 +18,8 @@ public class ItemTypeMap { | |||||||
|             if(item.getItemId().equals(name)){ |             if(item.getItemId().equals(name)){ | ||||||
|                 rVal = item; |                 rVal = item; | ||||||
|                 break; |                 break; | ||||||
|  |             } else if(item.getItemId().equalsIgnoreCase(name)){ | ||||||
|  |                 LoggerInterface.loggerEngine.WARNING("Failed to fetch item type data; however, item with different-capitalized name exists! May be a capitalization error!"); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         return rVal; |         return rVal; | ||||||
|  | |||||||
| @ -8,6 +8,8 @@ import electrosphere.net.parser.net.message.ServerMessage; | |||||||
| import electrosphere.net.parser.net.message.NetworkMessage.MessageType; | import electrosphere.net.parser.net.message.NetworkMessage.MessageType; | ||||||
| import electrosphere.net.parser.net.message.ServerMessage.ServerMessageType; | import electrosphere.net.parser.net.message.ServerMessage.ServerMessageType; | ||||||
| import electrosphere.net.parser.net.raw.NetworkParser; | import electrosphere.net.parser.net.raw.NetworkParser; | ||||||
|  | import electrosphere.net.server.ServerConnectionHandler; | ||||||
|  | 
 | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.io.InputStream; | import java.io.InputStream; | ||||||
| import java.io.OutputStream; | import java.io.OutputStream; | ||||||
| @ -168,7 +170,7 @@ public class ClientNetworking implements Runnable { | |||||||
| 
 | 
 | ||||||
|         //start parsing messages |         //start parsing messages | ||||||
|         initialized = true; |         initialized = true; | ||||||
|         while(Main.isRunning()){ |         while((Main.isRunning() || !ServerConnectionHandler.AUTO_CLOSE_THREAD)){ | ||||||
|             //attempt poll incoming messages |             //attempt poll incoming messages | ||||||
|             parser.readMessagesIn(); |             parser.readMessagesIn(); | ||||||
|             //outgoing messages |             //outgoing messages | ||||||
|  | |||||||
| @ -26,6 +26,12 @@ import java.util.concurrent.TimeUnit; | |||||||
|  */ |  */ | ||||||
| public class ServerConnectionHandler implements Runnable { | public class ServerConnectionHandler implements Runnable { | ||||||
| 
 | 
 | ||||||
|  |     /** | ||||||
|  |      * Automatically close threads if the main thread ends. | ||||||
|  |      * Used to make sure threads don't close while running test suite. | ||||||
|  |      */ | ||||||
|  |     public static boolean AUTO_CLOSE_THREAD = true; | ||||||
|  |      | ||||||
|     //the player id associated with this connection |     //the player id associated with this connection | ||||||
|     static int playerIdIncrementer = 0; |     static int playerIdIncrementer = 0; | ||||||
| 
 | 
 | ||||||
| @ -193,7 +199,7 @@ public class ServerConnectionHandler implements Runnable { | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|         initialized = true; |         initialized = true; | ||||||
|         while(Main.isRunning() && this.isConnected == true){ |         while((Main.isRunning() || !ServerConnectionHandler.AUTO_CLOSE_THREAD) && this.isConnected == true){ | ||||||
| 
 | 
 | ||||||
|             // |             // | ||||||
|             // Main Loop |             // Main Loop | ||||||
|  | |||||||
| @ -3,7 +3,6 @@ package electrosphere.entity.state.equip; | |||||||
| import static org.junit.jupiter.api.Assertions.assertNotNull; | import static org.junit.jupiter.api.Assertions.assertNotNull; | ||||||
| 
 | 
 | ||||||
| import org.joml.Vector3d; | import org.joml.Vector3d; | ||||||
| import org.junit.jupiter.api.Disabled; |  | ||||||
| 
 | 
 | ||||||
| import annotations.IntegrationTest; | import annotations.IntegrationTest; | ||||||
| import electrosphere.engine.Globals; | import electrosphere.engine.Globals; | ||||||
| @ -20,14 +19,13 @@ import testutils.TestEngineUtils; | |||||||
|  */ |  */ | ||||||
| public class ServerEquipStateTests extends EntityTestTemplate { | public class ServerEquipStateTests extends EntityTestTemplate { | ||||||
|      |      | ||||||
|     @Disabled |  | ||||||
|     @IntegrationTest |     @IntegrationTest | ||||||
|     public void spawningWithEquippedItem(){ |     public void spawningWithEquippedItem(){ | ||||||
|         TestEngineUtils.simulateFrames(1); |         TestEngineUtils.simulateFrames(1); | ||||||
|         //spawn entities |         //spawn entities | ||||||
|         CreatureTemplate creatureTemplate = CreatureTemplate.createDefault("human"); |         CreatureTemplate creatureTemplate = CreatureTemplate.createDefault("human"); | ||||||
|         Entity creature = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), "human", creatureTemplate); |         Entity creature = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), "human", creatureTemplate); | ||||||
|         Entity katana = ItemUtils.serverSpawnBasicItem(Globals.realmManager.first(), new Vector3d(0,0,0), "katana2H"); |         Entity katana = ItemUtils.serverSpawnBasicItem(Globals.realmManager.first(), new Vector3d(0,0,0), "Katana2H"); | ||||||
| 
 | 
 | ||||||
|         //equip |         //equip | ||||||
|         Entity inInventoryItem = InventoryUtils.serverAttemptStoreItem(creature, katana); |         Entity inInventoryItem = InventoryUtils.serverAttemptStoreItem(creature, katana); | ||||||
|  | |||||||
| @ -5,7 +5,6 @@ import electrosphere.menu.WindowUtils; | |||||||
| import electrosphere.menu.mainmenu.MenuGeneratorsUITesting; | import electrosphere.menu.mainmenu.MenuGeneratorsUITesting; | ||||||
| import template.RenderingTestTemplate; | import template.RenderingTestTemplate; | ||||||
| import testutils.TestEngineUtils; | import testutils.TestEngineUtils; | ||||||
| import testutils.TestRenderingUtils; |  | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Tests for the window class |  * Tests for the window class | ||||||
|  | |||||||
| @ -1,6 +1,7 @@ | |||||||
| package template; | package template; | ||||||
| 
 | 
 | ||||||
| import annotations.IntegrationSetup; | import annotations.IntegrationSetup; | ||||||
|  | import electrosphere.net.server.ServerConnectionHandler; | ||||||
| import testutils.EngineInit; | import testutils.EngineInit; | ||||||
| import testutils.TestEngineUtils; | import testutils.TestEngineUtils; | ||||||
| 
 | 
 | ||||||
| @ -12,7 +13,13 @@ public abstract class EntityTestTemplate extends RenderingTestTemplate { | |||||||
|     @IntegrationSetup |     @IntegrationSetup | ||||||
|     @Override |     @Override | ||||||
|     public void initEngine(){ |     public void initEngine(){ | ||||||
|  |         //init engine | ||||||
|         TestEngineUtils.initGraphicalEngine(); |         TestEngineUtils.initGraphicalEngine(); | ||||||
|  |          | ||||||
|  |         //make sure the server network threads continue to execute even if the main thread dies | ||||||
|  |         ServerConnectionHandler.AUTO_CLOSE_THREAD = false; | ||||||
|  | 
 | ||||||
|  |         //load scene | ||||||
|         EngineInit.setupConnectedTestScene(); |         EngineInit.setupConnectedTestScene(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -18,6 +18,7 @@ public class EngineInit { | |||||||
|     public static void setupConnectedTestScene(){ |     public static void setupConnectedTestScene(){ | ||||||
| 
 | 
 | ||||||
|         LoadingThread loadingThread = null; |         LoadingThread loadingThread = null; | ||||||
|  |         LoggerInterface.loggerNetworking.setLevel(LogLevel.LOOP_DEBUG); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|         // |         // | ||||||
| @ -25,8 +26,6 @@ public class EngineInit { | |||||||
|         loadingThread = new LoadingThread(LoadingThreadType.LEVEL,"testscene1"); |         loadingThread = new LoadingThread(LoadingThreadType.LEVEL,"testscene1"); | ||||||
|         loadingThread.start(); |         loadingThread.start(); | ||||||
| 
 | 
 | ||||||
|         LoggerInterface.loggerNetworking.setLevel(LogLevel.LOOP_DEBUG); |  | ||||||
| 
 |  | ||||||
|         // |         // | ||||||
|         //wait for client to be fully init'd |         //wait for client to be fully init'd | ||||||
|         while(((Window)Globals.elementManager.getWindow(WindowStrings.WINDOW_LOADING)).getVisible() || Globals.playerEntity == null){ |         while(((Window)Globals.elementManager.getWindow(WindowStrings.WINDOW_LOADING)).getVisible() || Globals.playerEntity == null){ | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user