blob: e8e307daa3c7190d0403bd15eb781b127ae85c4b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''Tests conversions of QString to and from QKeySequence.'''
import unittest
import py3kcompat as py3k
from helper import UsesQApplication
from PySide.QtGui import QKeySequence, QAction
class QStringQKeySequenceTest(UsesQApplication):
'''Tests conversions of QString to and from QKeySequence.'''
def testQStringFromQKeySequence(self):
'''Creates a QString from a QKeySequence.'''
keyseq = 'Ctrl+A'
a = QKeySequence(keyseq)
self.assertEqual(a, keyseq)
def testPythonStringAsQKeySequence(self):
'''Passes a Python string to an argument expecting a QKeySequence.'''
keyseq = py3k.unicode_('Ctrl+A')
action = QAction(None)
action.setShortcut(keyseq)
shortcut = action.shortcut()
self.assert_(isinstance(shortcut, QKeySequence))
self.assertEqual(shortcut.toString(), keyseq)
if __name__ == '__main__':
unittest.main()
|