class TestGameWindow(unittest.TestCase): def setUp(self): import time from PyQt5.QtWidgets import QApplication, QWidget, QLineEdit, QHBoxLayout from PyQt5.QtWidgets import QVBoxLayout, QLabel, QPushButton from PyQt5.QtGui import QPixmap, QIcon from PyQt5 import QtCore from PyQt5 import QtGui from WarConstants import WarConstants from Deck import Deck from GameManager import GameManager self.app = QApplication(sys.argv) self.gameMan = GameManager() self.gameWindow = GameWindow(200, 200, 800,500,"War Screen", self.gameMan) return def tearDown(self): self.gameWindow.close() del self.gameWindow sys.exit(self.app.exec_()) return def test_MoveCardToBack(self): testList = [1,2,3,4] correctTestList = [2,3,4,1] self.assertEquals(self.gameWindow._MoveCardToBack(testList),correctTestList) return
if __name__ == "__main__": app = QApplication(sys.argv) # Setup the game manager class gameMan = GameManager() # Create the start screen to setup the game constants print("Starting setup window") setupWindow = SetupWindow(gameMan, 400, 300, 200, 400, "Setup the Battle") gameMan.PlayerName = setupWindow.PlayerName gameMan.CompName = setupWindow.CompName gameMan.DeckCount = int(setupWindow.DeckCount) # Close the setup window setupWindow.close() print("Setup window closed") #_TestGameManagerSetup(gameMan) #print("Game code has continued") # Setup the gameplay window print("Starting main game window") gameWindow = GameWindow(200, 200, 800, 500, "War Screen", gameMan) gameWindow.close() print("Closed main game window") sys.exit(app.exec_()) print("App exited")