Example #1
0
def test_init(arcadeFactory):
    model = GameModel()

    assert model is not None

    model._factory = arcadeFactory
    model.initGame()

    assert model._cannon is not None
    assert arcadeFactory.createEnemy.call_count == 1
Example #2
0
class ShooterGame:
    def __init__(self):
        self.app = QApplication(sys.argv)
        self.state = State()
        self.gameModel = GameModel()
        self.controller = Controller(self.gameModel)
        self.view = GameView(self.controller, self.gameModel)
        self.gameModel.registerObserver(self.view)
        self.gameModel.setFactory()
        self.gameModel.initGame()

        sys.exit(self.app.exec_())