Пример #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')
Пример #2
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)
Пример #3
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")
Пример #4
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")
Пример #5
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')
Пример #6
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)
Пример #7
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)
Пример #8
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)
Пример #9
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)
Пример #10
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")
Пример #11
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")
Пример #12
0
 def test_status_method_contains_xfade(self):
     result = dict(status.status(self.context))
     self.assertIn("xfade", result)
     self.assertGreaterEqual(int(result["xfade"]), 0)
Пример #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)
Пример #14
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)
Пример #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)
Пример #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)
Пример #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)
Пример #18
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)
Пример #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)
Пример #20
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))
Пример #21
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)
Пример #22
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')
Пример #23
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)
Пример #24
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)
Пример #25
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)
Пример #26
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)
Пример #27
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)
Пример #28
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)
Пример #29
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))
Пример #30
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)