Пример #1
0
def test_player_stop():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    myplayer._player = mock.MagicMock()

    myplayer.stop()
    myplayer._player.stop.assert_called_once()
    assert myplayer.state == 0
Пример #2
0
def test_player_seek():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    myplayer._player = mock.MagicMock()

    myplayer.seek(1, 10)
    myplayer._player.set_time.assert_called_with(myplayer._player.get_time() +
                                                 10 * 1000)
Пример #3
0
def test_player_vlc_stop():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    myplayer._player = mock.MagicMock()

    myplayer.stop()
    assert myplayer._player.stop.call_count == 1
    assert myplayer.state == 0
Пример #4
0
def test_player_vlc_change_rate_decrease():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    myplayer._player = mock.MagicMock()
    myplayer._player.get_rate = mock.MagicMock(return_value=1)

    myplayer.change_rate(-1)
    myplayer._player.set_rate.assert_called_with(0.9)
Пример #5
0
def test_player_time_str():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    myplayer._player = mock.MagicMock()
    myplayer._media = mock.MagicMock()

    myplayer._player.get_time = mock.MagicMock(return_value=3000)
    myplayer._media.get_duration = mock.MagicMock(return_value=6000)
    assert myplayer.time_str == "00:00:03/00:00:06"
Пример #6
0
def test_player_vlc_play_from():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    myplayer._player = mock.MagicMock()
    myplayer.play_from(10)

    assert myplayer._player.play.call_count == 1
    assert myplayer.state == 1
    myplayer._player.set_time.assert_called_with(10 * 1000)
Пример #7
0
def test_player_vlc_change_rate_display():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    myplayer._player = mock.MagicMock()
    myplayer._player.get_rate = mock.MagicMock(return_value=1)
    display = mock.MagicMock()

    myplayer.change_rate(1, display=display)
    assert display.change_status.call_count == 1
Пример #8
0
def test_player_time():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    myplayer._player = mock.MagicMock()

    myplayer._player.get_time = mock.MagicMock(return_value=5000)
    assert myplayer.time == 5000
Пример #9
0
def test_player_vlc_change_rate_increase():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    myplayer._player = mock.MagicMock()

    myplayer.set_rate(1.6)
    assert myplayer._player.set_rate.call_count == 1