~ubuntu-branches/ubuntu/oneiric/pyside/oneiric

« back to all changes in this revision

Viewing changes to tests/qtcore/qchar_test.py

  • Committer: Bazaar Package Importer
  • Author(s): Didier Raboud
  • Date: 2010-09-27 21:01:06 UTC
  • mfrom: (1.2.1 upstream) (6.1.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20100927210106-m1nrq8vmd3exqb9o
Tags: 0.4.1-0ubuntu1
* New 0.4.1 upstream release. (LP: #648612)
  - Add some 0.4.1 symbols.

* Patches:
  - u_c130273_fix_py25_QtScript_property.patch
    Remove, was from upstream.
  - u_20e226b_fix_missing_qcoreapplication_arguments_method.patch
    Remove, was from upstream.
  - u_268bf77_fixed_signal_signature_parser.patch
    Remove, was from upstream.
  + libPythonVersionPostfix.patch: Refresh
  + usePySpecificShiboken.patch: Refresh
  + lessBuildVerbosity.patch: Refresh

* Bump the B-D chain versions.
* Make sure the private.py is installed in QtCore module.
* Build against Qt 4.7.
  - Add libqtwebkit-dev
  - Drop QtMultimedia module.
  - Add the QtDeclarative package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
'''Test cases for QChar'''
3
 
 
4
 
import unittest
5
 
 
6
 
from PySide.QtCore import QString, QChar, QTextStream, QLatin1Char
7
 
 
8
 
 
9
 
class EqualTest(unittest.TestCase):
10
 
    '''Tests for '__equal__'''
11
 
 
12
 
    def testEqualQChar(self):
13
 
        '''QChar == QChar'''
14
 
        self.assertEqual(QChar('a'), QChar('a'))
15
 
 
16
 
    def testEqualPyString(self):
17
 
        '''QChar == Python string'''
18
 
        self.assertEqual(QChar('a'), 'a')
19
 
 
20
 
 
21
 
class ImplicitConvQLatin1Char(unittest.TestCase):
22
 
    '''Tests for implicit conversion from QLatin1Char to QChar'''
23
 
 
24
 
    def testQLatin1CharToChar(self):
25
 
        '''QLatin1Char implicitly convertible to QChar'''
26
 
        stream = QTextStream()
27
 
        stream.setPadChar(QLatin1Char('-'))
28
 
        self.assertEqual(QChar('-'), stream.padChar())
29
 
 
30
 
 
31
 
class QCharCtorBigNumber(unittest.TestCase):
32
 
    '''QChar constructors receiving ints'''
33
 
 
34
 
    def testInt(self):
35
 
        '''QChar(int)'''
36
 
        codepoint = 512
37
 
        qchar = QChar(codepoint)
38
 
        reference = unichr(codepoint)
39
 
        self.assertEqual(qchar.unicode(), codepoint)
40
 
 
41
 
 
42
 
class QCharCtorString(unittest.TestCase):
43
 
    '''QChar constructor receiving strings'''
44
 
 
45
 
    def testBasic(self):
46
 
        '''QChar(char)'''
47
 
        reference = 'a'
48
 
        qchar = QChar(reference)
49
 
        self.assertEqual(ord(reference), ord(qchar.toAscii()))
50
 
 
51
 
    def testError(self):
52
 
        '''QChar(char)'''
53
 
        reference = 'aaaaaa'
54
 
        self.assertRaises(TypeError, QChar, reference)
55
 
 
56
 
 
57
 
if __name__ == '__main__':
58
 
    unittest.main()
59