Ejemplo n.º 1
0
 def test_status_method_when_starting_playing_contains_elapsed_zero(self):
     self.set_tracklist([Track(uri='dummy:/a', length=10000)])
     self.core.playback.play().get()
     self.core.playback.pause()
     result = dict(status.status(self.context))
     self.assertIn('elapsed', result)
     self.assertEqual(result['elapsed'], '0.000')
Ejemplo n.º 2
0
 def test_status_method_when_starting_playing_contains_elapsed_zero(self):
     self.set_tracklist([Track(uri='dummy:/a', length=10000)])
     self.core.playback.play().get()
     self.core.playback.pause()
     result = dict(status.status(self.context))
     self.assertIn('elapsed', result)
     self.assertEqual(result['elapsed'], '0.000')
Ejemplo n.º 3
0
    def test_status_method_when_playlist_loaded_contains_song(self):
        self.set_tracklist(Track(uri='dummy:/a'))

        self.core.playback.play().get()
        result = dict(status.status(self.context))
        self.assertIn('song', result)
        self.assertGreaterEqual(int(result['song']), 0)
Ejemplo n.º 4
0
    def test_status_method_when_playlist_loaded_contains_song(self):
        self.set_tracklist(Track(uri="dummy:/a"))

        self.core.playback.play().get()
        result = dict(status.status(self.context))
        self.assertIn("song", result)
        self.assertGreaterEqual(int(result["song"]), 0)
Ejemplo n.º 5
0
 def test_status_method_when_starting_playing_contains_elapsed_zero(self):
     self.set_tracklist(Track(uri="dummy:/a", length=10000))
     self.core.playback.play().get()
     self.core.playback.pause()
     result = dict(status.status(self.context))
     self.assertIn("elapsed", result)
     self.assertEqual(result["elapsed"], "0.000")
Ejemplo n.º 6
0
 def test_status_method_when_playing_contains_elapsed(self):
     self.set_tracklist([Track(uri='dummy:/a', length=60000)])
     self.core.playback.play().get()
     self.core.playback.pause()
     self.core.playback.seek(59123)
     result = dict(status.status(self.context))
     self.assertIn('elapsed', result)
     self.assertEqual(result['elapsed'], '59.123')
Ejemplo n.º 7
0
 def test_status_method_when_playing_contains_elapsed(self):
     self.set_tracklist(Track(uri="dummy:/a", length=60000))
     self.core.playback.play().get()
     self.core.playback.pause()
     self.core.playback.seek(59123)
     result = dict(status.status(self.context))
     self.assertIn("elapsed", result)
     self.assertEqual(result["elapsed"], "59.123")
Ejemplo n.º 8
0
 def test_status_method_when_playing_contains_elapsed(self):
     self.set_tracklist([Track(uri='dummy:/a', length=60000)])
     self.core.playback.play().get()
     self.core.playback.pause()
     self.core.playback.seek(59123)
     result = dict(status.status(self.context))
     self.assertIn('elapsed', result)
     self.assertEqual(result['elapsed'], '59.123')
Ejemplo n.º 9
0
 def test_status_method_when_playing_contains_time_with_length(self):
     self.set_tracklist([Track(uri='dummy:/a', length=10000)])
     self.core.playback.play().get()
     result = dict(status.status(self.context))
     self.assertIn('time', result)
     (position, total) = result['time'].split(':')
     position = int(position)
     total = int(total)
     self.assertLessEqual(position, total)
Ejemplo n.º 10
0
 def test_status_method_when_playing_contains_time_with_length(self):
     self.set_tracklist(Track(uri="dummy:/a", length=10000))
     self.core.playback.play()
     result = dict(status.status(self.context))
     self.assertIn("time", result)
     (position, total) = result["time"].split(":")
     position = int(position)
     total = int(total)
     self.assertLessEqual(position, total)
Ejemplo n.º 11
0
 def test_status_method_when_playing_contains_time_with_no_length(self):
     self.set_tracklist([Track(uri='dummy:/a', length=None)])
     self.core.playback.play().get()
     result = dict(status.status(self.context))
     self.assertIn('time', result)
     (position, total) = result['time'].split(':')
     position = int(position)
     total = int(total)
     self.assertLessEqual(position, total)
Ejemplo n.º 12
0
 def test_status_method_contains_state_is_stop(self):
     self.core.playback.state = STOPPED
     result = dict(status.status(self.context))
     self.assertIn("state", result)
     self.assertEqual(result["state"], "stop")
Ejemplo n.º 13
0
 def test_status_method_contains_playlistlength(self):
     result = dict(status.status(self.context))
     self.assertIn("playlistlength", result)
     self.assertGreaterEqual(int(result["playlistlength"]), 0)
Ejemplo n.º 14
0
 def test_status_method_contains_consume_is_1(self):
     self.core.tracklist.set_consume(True)
     result = dict(status.status(self.context))
     self.assertIn("consume", result)
     self.assertEqual(int(result["consume"]), 1)
Ejemplo n.º 15
0
 def test_status_method_contains_random_is_1(self):
     self.core.tracklist.set_random(True)
     result = dict(status.status(self.context))
     self.assertIn('random', result)
     self.assertEqual(int(result['random']), 1)
Ejemplo n.º 16
0
 def test_status_method_contains_volume(self):
     self.core.mixer.set_volume(17)
     result = dict(status.status(self.context))
     self.assertIn('volume', result)
     self.assertEqual(int(result['volume']), 17)
Ejemplo n.º 17
0
 def test_status_method_when_playing_contains_bitrate(self):
     self.set_tracklist([Track(uri='dummy:/a', bitrate=3200)])
     self.core.playback.play().get()
     result = dict(status.status(self.context))
     self.assertIn('bitrate', result)
     self.assertEqual(int(result['bitrate']), 3200)
Ejemplo n.º 18
0
 def test_status_method_contains_single(self):
     result = dict(status.status(self.context))
     self.assertIn('single', result)
     self.assertIn(int(result['single']), (0, 1))
Ejemplo n.º 19
0
 def test_status_method_contains_consume_is_1(self):
     self.core.tracklist.consume = 1
     result = dict(status.status(self.context))
     self.assertIn('consume', result)
     self.assertEqual(int(result['consume']), 1)
Ejemplo n.º 20
0
 def test_status_method_contains_repeat_is_1(self):
     self.core.tracklist.set_repeat(True)
     result = dict(status.status(self.context))
     self.assertIn('repeat', result)
     self.assertEqual(int(result['repeat']), 1)
Ejemplo n.º 21
0
 def test_status_method_contains_repeat_is_0(self):
     result = dict(status.status(self.context))
     self.assertIn('repeat', result)
     self.assertEqual(int(result['repeat']), 0)
Ejemplo n.º 22
0
 def test_status_method_contains_playlist(self):
     result = dict(status.status(self.context))
     self.assertIn('playlist', result)
     self.assertIn(int(result['playlist']), xrange(0, 2 ** 31 - 1))
Ejemplo n.º 23
0
 def test_status_method_contains_state_is_play(self):
     self.core.playback.state = PLAYING
     result = dict(status.status(self.context))
     self.assertIn('state', result)
     self.assertEqual(result['state'], 'play')
Ejemplo n.º 24
0
 def test_status_method_when_playing_contains_bitrate(self):
     self.core.tracklist.add([Track(uri='dummy:a', bitrate=320)])
     self.core.playback.play()
     result = dict(status.status(self.context))
     self.assertIn('bitrate', result)
     self.assertEqual(int(result['bitrate']), 320)
Ejemplo n.º 25
0
 def test_status_method_when_playlist_loaded_contains_tlid_as_songid(self):
     self.core.tracklist.add([Track(uri='dummy:a')])
     self.core.playback.play()
     result = dict(status.status(self.context))
     self.assertIn('songid', result)
     self.assertEqual(int(result['songid']), 0)
Ejemplo n.º 26
0
 def test_status_method_contains_consume_is_0(self):
     result = dict(status.status(self.context))
     self.assertIn('consume', result)
     self.assertEqual(int(result['consume']), 0)
Ejemplo n.º 27
0
 def test_status_method_contains_volume(self):
     self.core.playback.volume = 17
     result = dict(status.status(self.context))
     self.assertIn('volume', result)
     self.assertEqual(int(result['volume']), 17)
Ejemplo n.º 28
0
 def test_status_method_contains_consume_is_1(self):
     self.core.tracklist.set_consume(True)
     result = dict(status.status(self.context))
     self.assertIn('consume', result)
     self.assertEqual(int(result['consume']), 1)
Ejemplo n.º 29
0
 def test_status_method_contains_volume_with_na_value(self):
     result = dict(status.status(self.context))
     self.assertIn('volume', result)
     self.assertEqual(int(result['volume']), -1)
Ejemplo n.º 30
0
 def test_status_method_contains_playlist(self):
     result = dict(status.status(self.context))
     self.assertIn('playlist', result)
     self.assertGreaterEqual(int(result['playlist']), 0)
     self.assertLessEqual(int(result['playlist']), 2 ** 31 - 1)
Ejemplo n.º 31
0
 def test_status_method_contains_random_is_0(self):
     result = dict(status.status(self.context))
     self.assertIn('random', result)
     self.assertEqual(int(result['random']), 0)
Ejemplo n.º 32
0
 def test_status_method_contains_playlistlength(self):
     result = dict(status.status(self.context))
     self.assertIn('playlistlength', result)
     self.assertGreaterEqual(int(result['playlistlength']), 0)
Ejemplo n.º 33
0
 def test_status_method_contains_consume_is_0(self):
     result = dict(status.status(self.context))
     self.assertIn("consume", result)
     self.assertEqual(int(result["consume"]), 0)
Ejemplo n.º 34
0
 def test_status_method_contains_xfade(self):
     result = dict(status.status(self.context))
     self.assertIn('xfade', result)
     self.assertGreaterEqual(int(result['xfade']), 0)
Ejemplo n.º 35
0
 def test_status_method_contains_playlist(self):
     result = dict(status.status(self.context))
     self.assertIn("playlist", result)
     self.assertGreaterEqual(int(result["playlist"]), 0)
     self.assertLessEqual(int(result["playlist"]), 2 ** 31 - 1)
Ejemplo n.º 36
0
 def test_status_method_when_playing_contains_bitrate(self):
     self.set_tracklist(Track(uri="dummy:/a", bitrate=3200))
     self.core.playback.play().get()
     result = dict(status.status(self.context))
     self.assertIn("bitrate", result)
     self.assertEqual(int(result["bitrate"]), 3200)
Ejemplo n.º 37
0
 def test_status_method_contains_xfade(self):
     result = dict(status.status(self.context))
     self.assertIn("xfade", result)
     self.assertGreaterEqual(int(result["xfade"]), 0)
Ejemplo n.º 38
0
 def test_status_method_contains_volume(self):
     self.core.mixer.set_volume(17)
     result = dict(status.status(self.context))
     self.assertIn("volume", result)
     self.assertEqual(int(result["volume"]), 17)
Ejemplo n.º 39
0
 def test_status_method_contains_state_is_pause(self):
     self.core.playback.state = PLAYING
     self.core.playback.state = PAUSED
     result = dict(status.status(self.context))
     self.assertIn("state", result)
     self.assertEqual(result["state"], "pause")
Ejemplo n.º 40
0
 def test_status_method_contains_random_is_1(self):
     self.core.tracklist.set_random(True)
     result = dict(status.status(self.context))
     self.assertIn("random", result)
     self.assertEqual(int(result["random"]), 1)
Ejemplo n.º 41
0
 def test_status_method_contains_repeat_is_1(self):
     self.core.tracklist.repeat = 1
     result = dict(status.status(self.context))
     self.assertIn('repeat', result)
     self.assertEqual(int(result['repeat']), 1)
Ejemplo n.º 42
0
 def test_status_method_contains_random_is_1(self):
     self.core.tracklist.random = 1
     result = dict(status.status(self.context))
     self.assertIn('random', result)
     self.assertEqual(int(result['random']), 1)
Ejemplo n.º 43
0
 def test_status_method_contains_state_is_stop(self):
     self.core.playback.state = STOPPED
     result = dict(status.status(self.context))
     self.assertIn('state', result)
     self.assertEqual(result['state'], 'stop')
Ejemplo n.º 44
0
 def test_status_method_when_playlist_loaded_contains_nextsongid(self):
     self.set_tracklist([Track(uri='dummy:/a'), Track(uri='dummy:/b')])
     self.core.playback.play().get()
     result = dict(status.status(self.context))
     self.assertIn('nextsongid', result)
     self.assertEqual(int(result['nextsongid']), 2)
Ejemplo n.º 45
0
 def test_status_method_contains_volume_with_na_value(self):
     result = dict(status.status(self.context))
     self.assertIn("volume", result)
     self.assertEqual(int(result["volume"]), -1)
Ejemplo n.º 46
0
 def test_status_method_contains_state_is_pause(self):
     self.core.playback.state = PLAYING
     self.core.playback.state = PAUSED
     result = dict(status.status(self.context))
     self.assertIn('state', result)
     self.assertEqual(result['state'], 'pause')
Ejemplo n.º 47
0
 def test_status_method_contains_random_is_0(self):
     result = dict(status.status(self.context))
     self.assertIn("random", result)
     self.assertEqual(int(result["random"]), 0)
Ejemplo n.º 48
0
 def test_status_method_when_playlist_loaded_contains_nextsongid(self):
     self.set_tracklist([Track(uri='dummy:/a'), Track(uri='dummy:/b')])
     self.core.playback.play().get()
     result = dict(status.status(self.context))
     self.assertIn('nextsongid', result)
     self.assertEqual(int(result['nextsongid']), 2)
Ejemplo n.º 49
0
 def test_status_method_contains_single(self):
     result = dict(status.status(self.context))
     self.assertIn("single", result)
     self.assertIn(int(result["single"]), (0, 1))
Ejemplo n.º 50
0
 def test_status_method_when_playlist_loaded_contains_tlid_as_songid(self):
     self.core.tracklist.add([Track(uri='dummy:a')])
     self.core.playback.play()
     result = dict(status.status(self.context))
     self.assertIn('songid', result)
     self.assertEqual(int(result['songid']), 0)