def setUp(self):

        self.playerInfo = PlayerInfo()
        self.playerInfo.set_provider('yly', 'http://uri-logo.com')
        self.playerInfo.set_provider_name('yyy-second')

        self.playerInfo.set_lyric('http://uri-lrc.com')
        self.playerInfo.set_art('art')
        self.playerInfo.set_title('title')
        self.playerInfo.set_title_subtext1('sub text1')
        self.playerInfo.set_title_subtext2('sub text2')
        self.playerInfo.set_audio_item_type(PlayerInfoAudioItemEnum.FORMAT_LRC)
        self.playerInfo.set_media_length_in_ms(12321.232)

        favoriteButton = FavoriteButton()
        favoriteButton.set_enabled(False)
        self.playerInfo.add_control(favoriteButton)

        showPlayListButton = ShowPlayListButton()
        showPlayListButton.set_selected(True)
        self.playerInfo.set_controls(showPlayListButton)

        showFavoriteListButton = ShowFavoriteListButton()
        repeatButton = RepeatButton(RepeatButtonEnum.REPEAT_ONE)
        self.playerInfo.set_controls([showFavoriteListButton, repeatButton])
    def testGetData(self):

        with open('../../json/render_audio.json', encoding='utf-8') as f:
            content = f.read()
            self.data = json.loads(content)

        print(self.data)
        content = AudioPlayerInfoContent()
        content.set_title('title')
        content.set_title_sub_text1('titleSubtext1')
        content.set_title_sub_text2('titleSubtext2')
        content.set_lyric('www.lyric.com')
        content.set_media_length_in_ms(10000)
        content.set_art('www.art.com')
        content.set_provider('provider', 'www.logo.com')

        playPauseButton = PlayPauseButton()
        repeatButton = RepeatButton()
        controls = [playPauseButton, repeatButton]

        self.renderAudioPlayerInfo.set_token('test_token')
        self.renderAudioPlayerInfo.set_content(content)
        self.renderAudioPlayerInfo.set_controls(controls)
        self.assertEqual(self.renderAudioPlayerInfo.get_data(), self.data)
Exemple #3
0
 def setUp(self):
     self.repeatButton = RepeatButton()
     self.repeatButton.set_selected_value(RepeatButtonEnum.REPEAT_ONE)