~ubuntu-branches/ubuntu/wily/remuco-server/wily

« back to all changes in this revision

Viewing changes to base/module/test/testadapter.py

  • Committer: Bazaar Package Importer
  • Author(s): Chow Loong Jin
  • Date: 2009-03-30 00:59:36 UTC
  • Revision ID: james.westby@ubuntu.com-20090330005936-hkxki384hm0d33gj
Tags: upstream-0.8.2.1
ImportĀ upstreamĀ versionĀ 0.8.2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# =============================================================================
 
2
#
 
3
#    Remuco - A remote control system for media players.
 
4
#    Copyright (C) 2006-2009 Oben Sonne <obensonne@googlemail.com>
 
5
#
 
6
#    This file is part of Remuco.
 
7
#
 
8
#    Remuco is free software: you can redistribute it and/or modify
 
9
#    it under the terms of the GNU General Public License as published by
 
10
#    the Free Software Foundation, either version 3 of the License, or
 
11
#    (at your option) any later version.
 
12
#
 
13
#    Remuco is distributed in the hope that it will be useful,
 
14
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
#    GNU General Public License for more details.
 
17
#
 
18
#    You should have received a copy of the GNU General Public License
 
19
#    along with Remuco.  If not, see <http://www.gnu.org/licenses/>.
 
20
#
 
21
# =============================================================================
 
22
 
 
23
import unittest
 
24
 
 
25
import gobject
 
26
 
 
27
import sys
 
28
 
 
29
import remuco.log
 
30
from remuco import PlayerAdapter
 
31
 
 
32
 
 
33
class AdapterTest(unittest.TestCase):
 
34
 
 
35
    def setUp(self):
 
36
        
 
37
        self.__ml = gobject.MainLoop()
 
38
        
 
39
        ia = remuco.ItemAction("ia_l", multiple=True)
 
40
 
 
41
        logarg = "--remuco-log-stdout"
 
42
        if not logarg in sys.argv:
 
43
            sys.argv.append(logarg)
 
44
 
 
45
        self.__pa = PlayerAdapter("unittest", playback_known=False,
 
46
            volume_known=True, repeat_known=True, shuffle_known=False,
 
47
            progress_known=True, max_rating=3, mime_types=["audio"], poll=1,
 
48
            file_actions=[ia])
 
49
        
 
50
        #self.__pa.config.log_level = remuco.log.DEBUG
 
51
        #self.__pa.config.log_level = remuco.log.INFO
 
52
        self.__pa.config.log_level = remuco.log.WARNING
 
53
 
 
54
    def test_adapter(self):
 
55
 
 
56
        self.__pa.start()
 
57
        
 
58
        gobject.timeout_add(4000, self.__stop)
 
59
        
 
60
        self.__ml.run()
 
61
 
 
62
    def __stop(self):
 
63
        
 
64
        self.__pa.stop()
 
65
        self.__ml.quit()
 
66
        
 
67
 
 
68
if __name__ == "__main__":
 
69
    #import sys;sys.argv = ['', 'Test.test_adapter']
 
70
    unittest.main()
 
 
b'\\ No newline at end of file'