~ubuntu-branches/ubuntu/utopic/pyside/utopic

« back to all changes in this revision

Viewing changes to tests/QtGui/bug_660.py

  • Committer: Bazaar Package Importer
  • Author(s): Didier Raboud
  • Date: 2011-02-18 18:01:00 UTC
  • mfrom: (1.2.3 upstream) (6.1.6 experimental)
  • Revision ID: james.westby@ubuntu.com-20110218180100-vaczjij7g08fzfme
Tags: 1.0.0~rc1-1
* New 1.0.0~rc1 upstream release
  - Bump the B-D chain versions:
    + apiextractor to 0.10.0-2~
    + generatorrunner to 0.6.6
    + shiboken to 1.0.0~rc1
* Update patches to ~rc1.
* debian/watch: update to handle Release Candidates too.
* Bump XS-Python-Version to >= 2.6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import unittest
 
2
from PySide.QtCore import *
 
3
from PySide.QtGui import *
 
4
 
 
5
class MyItemModel(QStandardItemModel):
 
6
    def __init__(self,parent=None):
 
7
        super(MyItemModel,self).__init__(parent)
 
8
        self.appendRow([QStandardItem('Item 1'),])
 
9
 
 
10
    def mimeTypes(self):
 
11
        mtypes = super(MyItemModel,self).mimeTypes()
 
12
        mtypes.append(u'application/my-form')
 
13
        return mtypes
 
14
 
 
15
    def mimeData(self,indexes):
 
16
        self.__mimedata = super(MyItemModel,self).mimeData(indexes)
 
17
        self.__mimedata.setData(u'application/my-form', 'hi')
 
18
        return self.__mimedata
 
19
 
 
20
class TestBug660(unittest.TestCase):
 
21
    '''QMimeData type deleted prematurely when overriding mime-type in QStandardItemModel drag and drop'''
 
22
    def testIt(self):
 
23
        model = MyItemModel()
 
24
        model.mimeData([model.index(0, 0)]) # if it doesn't raise an exception it's all right!
 
25
 
 
26
if __name__ == '__main__':
 
27
    unittest.main()