Fix bug#309 - "QtCore.QByteArray() or list from QtCore.Qsettings.value() as default"
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Renato Araújo <renato.araujo@openbossa.org>
This commit is contained in:
parent
7b2903ad21
commit
d27d6958c0
2 changed files with 8 additions and 3 deletions
|
|
@ -28,6 +28,9 @@ struct Converter<QVariant>
|
||||||
} else if (Converter<QString>::checkType(pyObj)) {
|
} else if (Converter<QString>::checkType(pyObj)) {
|
||||||
// QVariant(const char*)
|
// QVariant(const char*)
|
||||||
return QVariant(Converter<QString>::toCpp(pyObj));
|
return QVariant(Converter<QString>::toCpp(pyObj));
|
||||||
|
} else if (Converter<QByteArray>::checkType(pyObj)) {
|
||||||
|
// QVariant(QByteArray)
|
||||||
|
return QVariant(Converter<QByteArray>::toCpp(pyObj));
|
||||||
} else if (PyFloat_CheckExact(pyObj)) {
|
} else if (PyFloat_CheckExact(pyObj)) {
|
||||||
// QVariant(double)
|
// QVariant(double)
|
||||||
return QVariant(Converter<double>::toCpp(pyObj));
|
return QVariant(Converter<double>::toCpp(pyObj));
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import unittest
|
||||||
import ctypes
|
import ctypes
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from PySide.QtCore import QByteArray
|
from PySide.QtCore import *
|
||||||
|
|
||||||
class QByteArrayTestToNumber(unittest.TestCase):
|
class QByteArrayTestToNumber(unittest.TestCase):
|
||||||
def testToNumberInt(self):
|
def testToNumberInt(self):
|
||||||
|
|
@ -91,8 +91,10 @@ class QByteArrayOperatorAtSetterLargeIndex(unittest.TestCase):
|
||||||
obj[10] = 'normal'
|
obj[10] = 'normal'
|
||||||
self.assertEqual(obj, QByteArray('mystring normal'))
|
self.assertEqual(obj, QByteArray('mystring normal'))
|
||||||
|
|
||||||
|
class QByteArrayOnQVariant(unittest.TestCase):
|
||||||
|
def testQByteArrayOnQVariant(self):
|
||||||
|
a = QSettings().value("some_prop", QByteArray())
|
||||||
|
self.assertEqual(type(a), QByteArray)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue