aboutsummaryrefslogtreecommitdiffstats
path: root/tests
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
parent34529760f4766a84a7dbb8f32c776abfe9c4fdda (diff)
Fix bug 660 - "QMimeData type deleted prematurely when overriding mime-type in QStandardItemModel drag and drop"
Diffstat (limited to 'tests')
-rw-r--r--tests/QtGui/CMakeLists.txt1
-rw-r--r--tests/QtGui/bug_660.py27
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/QtGui/CMakeLists.txt b/tests/QtGui/CMakeLists.txt
index 83af1e610..d4e914107 100644
--- a/tests/QtGui/CMakeLists.txt
+++ b/tests/QtGui/CMakeLists.txt
@@ -34,6 +34,7 @@ PYSIDE_TEST(bug_617.py)
PYSIDE_TEST(bug_640.py)
PYSIDE_TEST(bug_652.py)
PYSIDE_TEST(bug_653.py)
+PYSIDE_TEST(bug_660.py)
PYSIDE_TEST(customproxywidget_test.py)
PYSIDE_TEST(deepcopy_test.py)
PYSIDE_TEST(float_to_int_implicit_conversion_test.py)
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()