Esempio n. 1
0
 def setUp(self):
     BobbleHeadPresenter.timer_util = TestyTimerUtil
     Song.music_player = QuietMusicPlayer
     self.view = Mock()
     self.view.song_actions = []
     self.view.speed_actions = []
     self.presenter = BobbleHeadPresenter(self.view)
Esempio n. 2
0
def main():
    inject_dependencies()
    app = QApplication(sys.argv)
    app.setApplicationName(Application.NAME)
    view = BobbleHeadView()
    presenter = BobbleHeadPresenter(view)
    presenter.initialize()
    sys.exit(app.exec_())
Esempio n. 3
0
def main():
    inject_dependencies()
    app = QApplication(sys.argv)
    app.setApplicationName(Application.NAME)
    view = BobbleHeadView()
    presenter = BobbleHeadPresenter(view)
    presenter.initialize()
    sys.exit(app.exec_())
Esempio n. 4
0
class BobbleHeadPresenterTest(unittest.TestCase):


    def setUp(self):
        BobbleHeadPresenter.timer_util = TestyTimerUtil
        Song.music_player = QuietMusicPlayer
        self.view = Mock()
        self.view.song_actions = []
        self.view.speed_actions = []
        self.presenter = BobbleHeadPresenter(self.view)

    def tearDown(self):
        QuietMusicPlayer.CURRENTLY_PLAYING = None

    def test_initialize_everything(self):
        self.presenter.initialize()
        self.assertEquals(3, len(self.view.method_calls))
        self.view.render.assert_called_once_with()
        self.view.set_head_location.assert_called_once_with(Point(210, 0), 0)
        self.view.show.assert_called_once_with()
        self.assertEquals(20, self.presenter.timer.speed)
        self.assertEquals(FileLocation.MIDI, QuietMusicPlayer.CURRENTLY_PLAYING)

    def test_bobbling_a_few_times(self):
        self.presenter.initialize()
        self.view.reset_mock()
        self.presenter.bobble_the_head()
        self.view.set_head_location.assert_called_with(Point(210, 1), 1)
        self.presenter.bobble_the_head()
        self.view.set_head_location.assert_called_with(Point(210, 2), 2)
Esempio n. 5
0
class BobbleHeadPresenterTest(unittest.TestCase):
    def setUp(self):
        BobbleHeadPresenter.timer_util = TestyTimerUtil
        Song.music_player = QuietMusicPlayer
        self.view = Mock()
        self.view.song_actions = []
        self.view.speed_actions = []
        self.presenter = BobbleHeadPresenter(self.view)

    def tearDown(self):
        QuietMusicPlayer.CURRENTLY_PLAYING = None

    def test_initialize_everything(self):
        self.presenter.initialize()
        self.assertEquals(3, len(self.view.method_calls))
        self.view.render.assert_called_once_with()
        self.view.set_head_location.assert_called_once_with(Point(210, 0), 0)
        self.view.show.assert_called_once_with()
        self.assertEquals(20, self.presenter.timer.speed)
        self.assertEquals(FileLocation.MIDI,
                          QuietMusicPlayer.CURRENTLY_PLAYING)

    def test_bobbling_a_few_times(self):
        self.presenter.initialize()
        self.view.reset_mock()
        self.presenter.bobble_the_head()
        self.view.set_head_location.assert_called_with(Point(210, 1), 1)
        self.presenter.bobble_the_head()
        self.view.set_head_location.assert_called_with(Point(210, 2), 2)
Esempio n. 6
0
 def setUp(self):
     BobbleHeadPresenter.timer_util = TestyTimerUtil
     Song.music_player = QuietMusicPlayer
     self.view = Mock()
     self.view.song_actions = []
     self.view.speed_actions = []
     self.presenter = BobbleHeadPresenter(self.view)