Skip to content

Commit

Permalink
ci: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BruceZhang1993 committed May 9, 2023
1 parent 011b4cf commit 2562455
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions tests/test_nowplaying.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class NowPlayingInterface(aionp.NowPlayingInterface):
def __init__(self):
super().__init__(self.NAME)

def update_playback_mode(self):
self.set_playback_property(PlayProp.LoopStatus, aionp.LoopStatus.Playlist)
self.set_playback_property(PlayProp.Shuffle, True)
def update_playback_mode(self, loop_status: aionp.LoopStatus, shuffle: bool):
self.set_playback_property(PlayProp.LoopStatus, loop_status)
self.set_playback_property(PlayProp.Shuffle, shuffle)

def update_song_props(self, meta: dict):
metadata = aionp.PlaybackProperties.MetadataBean()
Expand All @@ -30,8 +30,8 @@ def update_song_props(self, meta: dict):
def update_position(self, position):
self.set_playback_property(PlayProp.Position, int(position * 1000))

def update_playback_status(self):
self.set_playback_property(PlayProp.PlaybackStatus, aionp.PlaybackStatus.Playing)
def update_playback_status(self, status: aionp.PlaybackStatus):
self.set_playback_property(PlayProp.PlaybackStatus, status)

def on_play(self):
print('on_play')
Expand Down Expand Up @@ -70,3 +70,26 @@ async def test_update_song_props(server: NowPlayingInterface):
'artists': ["hello world"],
'album': 'Hello World'
})


async def test_update_position(server: NowPlayingInterface):
server.update_position(20)


async def test_update_playback_status(server: NowPlayingInterface):
server.update_playback_status(aionp.PlaybackStatus.Playing)


async def test_update_playback_mode(server: NowPlayingInterface):
server.update_playback_mode(aionp.LoopStatus.Playlist, True)
server.update_playback_mode(aionp.LoopStatus.Track, False)
server.update_playback_mode(aionp.LoopStatus.None_, False)


async def test_update_properties(server: NowPlayingInterface):
server.set_property(aionp.PropertyName.CanQuit, True)
server.set_property(aionp.PropertyName.CanRaise, True)
server.set_property(aionp.PropertyName.CanSetFullscreen, True)
server.set_property(aionp.PropertyName.Fullscreen, True)
server.set_property(aionp.PropertyName.SupportedMimeTypes, ['audio/mpeg'])
server.set_property(aionp.PropertyName.SupportedUriSchemes, ['aionp:'])

0 comments on commit 2562455

Please sign in to comment.