Added a new case to translation unit tests.
The new test calls QCoreApplication.translate passing None to an argument that in C++ expects a 'const char*' and accepts a null pointer. Reviewed by Lauro Moura <lauro.neto@openbossa.org>
This commit is contained in:
parent
c440eccaef
commit
babe9db551
1 changed files with 6 additions and 2 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
from PySide.QtCore import QObject, QTranslator, QCoreApplication
|
from PySide.QtCore import QObject, QTranslator, QCoreApplication, QString
|
||||||
|
|
||||||
from helper import UsesQCoreApplication
|
from helper import UsesQCoreApplication
|
||||||
|
|
||||||
|
|
@ -51,7 +51,11 @@ class TranslationTest(UsesQCoreApplication):
|
||||||
obj.setObjectName(obj.trUtf8('Hello World!'))
|
obj.setObjectName(obj.trUtf8('Hello World!'))
|
||||||
self.assertEqual(obj.objectName(), u'привет мир!')
|
self.assertEqual(obj.objectName(), u'привет мир!')
|
||||||
|
|
||||||
|
def testTranslateWithNoneDisambiguation(self):
|
||||||
|
value = 'String here'
|
||||||
|
obj = QCoreApplication.translate('context', value, None, QCoreApplication.UnicodeUTF8)
|
||||||
|
self.assert_(isinstance(obj, QString))
|
||||||
|
self.assertEqual(obj, value)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue