aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtGui/bug_660.py
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-02-04 17:42:38 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:53:54 -0300
commit59c882566be0d58c256f715ce675f10f3181ccc3 (patch)
tree68a16a0910f13785aae35f75f6305ed4edb33640 /tests/QtGui/bug_660.py
parent34529760f4766a84a7dbb8f32c776abfe9c4fdda (diff)
Fix bug 660 - "QMimeData type deleted prematurely when overriding mime-type in QStandardItemModel drag and drop"
Diffstat (limited to 'tests/QtGui/bug_660.py')
-rw-r--r--tests/QtGui/bug_660.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/QtGui/bug_660.py b/tests/QtGui/bug_660.py
new file mode 100644
index 000000000..f001d36f2
--- /dev/null
+++ b/tests/QtGui/bug_660.py
@@ -0,0 +1,27 @@
+import unittest
+from PySide.QtCore import *
+from PySide.QtGui import *
+
+class MyItemModel(QStandardItemModel):
+ def __init__(self,parent=None):
+ super(MyItemModel,self).__init__(parent)
+ self.appendRow([QStandardItem('Item 1'),])
+
+ def mimeTypes(self):
+ mtypes = super(MyItemModel,self).mimeTypes()
+ mtypes.append(u'application/my-form')
+ return mtypes
+
+ def mimeData(self,indexes):
+ self.__mimedata = super(MyItemModel,self).mimeData(indexes)
+ self.__mimedata.setData(u'application/my-form', 'hi')
+ return self.__mimedata
+
+class TestBug660(unittest.TestCase):
+ '''QMimeData type deleted prematurely when overriding mime-type in QStandardItemModel drag and drop'''
+ def testIt(self):
+ model = MyItemModel()
+ model.mimeData([model.index(0, 0)]) # if it doesn't raise an exception it's all right!
+
+if __name__ == '__main__':
+ unittest.main()