aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--player_mock.py42
-rw-r--r--player_vlc.py22
-rw-r--r--solo_tool_integrationtest.py43
3 files changed, 54 insertions, 53 deletions
diff --git a/player_mock.py b/player_mock.py
new file mode 100644
index 0000000..2fcb725
--- /dev/null
+++ b/player_mock.py
@@ -0,0 +1,42 @@
+class Player():
+ STOPPED = 0
+ PLAYING = 1
+ PAUSED = 2
+
+ def __init__(self):
+ self.state = Player.STOPPED
+ self.rate = 1.0
+ self.position = 0.0
+ self.volume = 1.0
+ self.currentSong = None
+
+ def play(self):
+ self.state = Player.PLAYING
+
+ def stop(self):
+ self.state = Player.STOPPED
+
+ def pause(self):
+ self.state = Player.PAUSED
+
+ def setPlaybackRate(self, rate):
+ self.rate = rate
+
+ def getPlaybackRate(self):
+ return self.rate
+
+ def setPlaybackPosition(self, position):
+ self.position = position
+
+ def getPlaybackPosition(self):
+ return self.position
+
+ def setPlaybackVolume(self, volume):
+ self.volume = volume
+
+ def getPlaybackVolume(self):
+ return self.volume
+
+ def setCurrentSong(self, path):
+ self.currentSong = path
+
diff --git a/player_vlc.py b/player_vlc.py
index 9c8362a..1418dd0 100644
--- a/player_vlc.py
+++ b/player_vlc.py
@@ -2,35 +2,35 @@ import vlc
class Player:
def __init__(self):
- self.player = vlc.MediaPlayer()
+ self._player = vlc.MediaPlayer()
def play(self):
- self.player.play()
+ self._player.play()
def stop(self):
- self.player.stop()
+ self._player.stop()
def pause(self):
- self.player.pause()
+ self._player.pause()
def setPlaybackRate(self, rate):
- self.player.set_rate(rate)
+ self._player.set_rate(rate)
def getPlaybackRate(self):
- return self.player.get_rate()
+ return self._player.get_rate()
def setPlaybackPosition(self, position):
- self.player.set_position(position)
+ self._player.set_position(position)
def getPlaybackPosition(self):
- return self.player.get_position()
+ return self._player.get_position()
def setPlaybackVolume(self, volume):
- self.player.audio_set_volume(int(volume * 100))
+ self._player.audio_set_volume(int(volume * 100))
def getPlaybackVolume(self):
- return self.player.audio_get_volume() / 100.0
+ return self._player.audio_get_volume() / 100.0
def setCurrentSong(self, path):
media = vlc.Media(path)
- self.player.set_media(media)
+ self._player.set_media(media)
diff --git a/solo_tool_integrationtest.py b/solo_tool_integrationtest.py
index cd635d4..a927bfb 100644
--- a/solo_tool_integrationtest.py
+++ b/solo_tool_integrationtest.py
@@ -1,49 +1,8 @@
from solo_tool import SoloTool
+from player_mock import Player as MockPlayer
import pathlib
import shutil
-class MockPlayer():
- STOPPED = 0
- PLAYING = 1
- PAUSED = 2
-
- def __init__(self):
- self.state = MockPlayer.STOPPED
- self.rate = 1.0
- self.position = 0.0
- self.volume = 1.0
- self.currentSong = None
-
- def play(self):
- self.state = MockPlayer.PLAYING
-
- def stop(self):
- self.state = MockPlayer.STOPPED
-
- def pause(self):
- self.state = MockPlayer.PAUSED
-
- def setPlaybackRate(self, rate):
- self.rate = rate
-
- def getPlaybackRate(self):
- return self.rate
-
- def setPlaybackPosition(self, position):
- self.position = position
-
- def getPlaybackPosition(self):
- return self.position
-
- def setPlaybackVolume(self, volume):
- self.volume = volume
-
- def getPlaybackVolume(self):
- return self.volume
-
- def setCurrentSong(self, path):
- self.currentSong = path
-
def test_playerControls():
mockPlayer = MockPlayer()
uut = SoloTool(mockPlayer)