示例#1
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
示例#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_stop():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    myplayer._player = mock.MagicMock()

    myplayer.stop()
    myplayer._player.stop.assert_called_once()
    assert myplayer.state == 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)
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_episode():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    assert myplayer.episode == episode
示例#10
0
def test_player_str():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    assert str(myplayer) == myplayer.title
示例#11
0
def test_player_del():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    assert "myplayer" in locals()
    del myplayer
    assert "myplayer" not in locals()
示例#12
0
def test_player_init():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    assert isinstance(myplayer, VLCPlayer)
示例#13
0
def test_player_vlc_title():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    assert myplayer.title == "player1 title"
示例#14
0
def test_player_vlc_str():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    assert str(myplayer) == "[%s] %s" % (episode.feed_str, myplayer.title)
示例#15
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