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

« back to all changes in this revision

Viewing changes to tests/qtcore/qobject_tr_as_instance_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
 
#!/usr/bin/python
2
 
# -*- coding: utf-8 -*-
3
 
 
4
 
'''Unit tests for QObject's tr and trUtf8 static methods.'''
5
 
 
6
 
import os
7
 
import unittest
8
 
from PySide.QtCore import QObject
9
 
 
10
 
#from helper import UsesQCoreApplication
11
 
 
12
 
class QObjectTrTest(unittest.TestCase):
13
 
    '''Test case to check if QObject tr and trUtf8 static methods could be treated as instance methods.'''
14
 
 
15
 
    def setUp(self):
16
 
        self.obj = QObject()
17
 
 
18
 
    def tearDown(self):
19
 
        del self.obj
20
 
 
21
 
    def testTrCommonCase(self):
22
 
        #Test common case for QObject.tr
23
 
        invar1 = 'test1'
24
 
        outvar1 = self.obj.tr(invar1)
25
 
        invar2 = 'test2'
26
 
        outvar2 = self.obj.tr(invar2, 'test comment')
27
 
        self.assertEqual((invar1, invar2), (outvar1, outvar2))
28
 
 
29
 
    def testTrAsInstanceMethod(self):
30
 
        #Test QObject.tr as instance
31
 
        invar1 = 'test1'
32
 
        outvar1 = QObject.tr(self.obj, invar1)
33
 
        invar2 = 'test2'
34
 
        outvar2 = QObject.tr(self.obj, invar2, 'test comment')
35
 
        self.assertEqual((invar1, invar2), (outvar1, outvar2))
36
 
 
37
 
    def testTrUtf8CommonCase(self):
38
 
        #Test common case for QObject.trUtf8
39
 
        invar1 = 'test1'
40
 
        outvar1 = self.obj.trUtf8(invar1)
41
 
        invar2 = 'test2'
42
 
        outvar2 = self.obj.trUtf8(invar2, 'test comment')
43
 
        self.assertEqual((invar1, invar2), (outvar1, outvar2))
44
 
 
45
 
    def testTrUtf8AsInstanceMethod(self):
46
 
        #Test QObject.trUtf8 as instance
47
 
        invar1 = 'test1'
48
 
        outvar1 = QObject.trUtf8(self.obj, invar1)
49
 
        invar2 = 'test2'
50
 
        outvar2 = QObject.trUtf8(self.obj, invar2, 'test comment')
51
 
        self.assertEqual((invar1, invar2), (outvar1, outvar2))
52
 
 
53
 
if __name__ == '__main__':
54
 
    unittest.main()
55