diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-05-03 12:21:54 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:17 -0300 |
commit | 2ef1ba00c7d00b6277f8ab96e5d02c4f085abbc4 (patch) | |
tree | f4e2b8fc804483a0859e3cb9e2eb3da9e3a154d0 /tests/manually | |
parent | 2b69cc925f009b38a73495f82e74ac6992cf11d8 (diff) |
Create manually dir for tests.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
Diffstat (limited to 'tests/manually')
-rw-r--r-- | tests/manually/README.txt | 5 | ||||
-rw-r--r-- | tests/manually/bug_841.py | 50 |
2 files changed, 55 insertions, 0 deletions
diff --git a/tests/manually/README.txt b/tests/manually/README.txt new file mode 100644 index 000000000..1042dfcf2 --- /dev/null +++ b/tests/manually/README.txt @@ -0,0 +1,5 @@ +To run these tests is necessary some manually input (most of then not supported by QTest[1]), +because of that this is not part of automatic test context. + + +[1]http://bugreports.qt.nokia.com/browse/QTBUG-13397 diff --git a/tests/manually/bug_841.py b/tests/manually/bug_841.py new file mode 100644 index 000000000..007cd6af1 --- /dev/null +++ b/tests/manually/bug_841.py @@ -0,0 +1,50 @@ +import sys
+
+from PySide.QtCore import *
+from PySide.QtGui import *
+from PySide.QtTest import *
+
+class Item(QStandardItem):
+ def __init__(self, text):
+ super(Item, self).__init__()
+ self.setText(text)
+ self.setDragEnabled(True)
+ self.setDropEnabled(True)
+
+ def clone(self):
+ ret = Item(self.text())
+ return ret
+
+class Project(QStandardItemModel):
+ def __init__(self):
+ super(Project, self).__init__()
+ self.setItemPrototype(Item("Prototype"))
+ # add some items so we have stuff to move around
+ self.appendRow(Item("ABC"))
+ self.appendRow(Item("DEF"))
+ self.appendRow(Item("GHI"))
+
+class MainWindow(QMainWindow):
+ def __init__(self):
+ super(MainWindow, self).__init__()
+
+ self.model = Project()
+ self.view = QTreeView(self)
+ self.view.setModel(self.model)
+ self.view.setDragEnabled(True)
+ self.view.setDragDropMode(QAbstractItemView.InternalMove)
+ self.setCentralWidget(self.view)
+
+ def mousePressEvent(self, e):
+ print e.x(), e.y()
+ return QMainWindow.mousePressEvent(self, e)
+
+def main():
+ app = QApplication(sys.argv)
+ w = MainWindow()
+ w.show()
+ QMessageBox.information(None, "Info", "Just drag and drop the itens.")
+ sys.exit(app.exec_())
+
+if __name__ == "__main__":
+ main()
|