diff test/testdiagrameditor.py @ 392:bb4289c84907

Added some sort of drop event test
author Windel Bouwman
date Fri, 16 May 2014 13:05:10 +0200
parents b77f3290ac79
children c0d9837acde8
line wrap: on
line diff
--- a/test/testdiagrameditor.py	Fri May 16 12:30:10 2014 +0200
+++ b/test/testdiagrameditor.py	Fri May 16 13:05:10 2014 +0200
@@ -9,9 +9,10 @@
     sys.path.insert(0, otherpath)
     import diagrameditor
 
-    from PyQt5.QtWidgets import QApplication
+    from PyQt5.QtWidgets import QApplication, QGraphicsItem
     from PyQt5.QtTest import QTest
-    from PyQt5.QtCore import Qt, QTimer
+    from PyQt5.QtCore import Qt, QTimer, QMimeData, QPointF
+    from PyQt5.QtGui import QDropEvent
     skip_it = False
 
     # When creating an app per testcase, this fails horribly..
@@ -47,10 +48,21 @@
         print(editor, type(editor))
         QTest.mouseMove(editor)
         QTest.mouseRelease(editor, Qt.LeftButton)
+        mimedata = QMimeData()
+        mimedata.setData('component/name', 'Block:blk'.encode('ascii'))
+        de = QDropEvent(QPointF(10, 10), Qt.CopyAction, mimedata,
+                        Qt.LeftButton,
+                        Qt.NoModifier)
+        editor.dropEvent(de)
+
+    def resizePlacedItem(self):
+        i = self.main.findChild(QGraphicsItem, "sizer_top_right")
+        print(i)
 
     def testScenario1(self):
         self.cmdNewModel()
         self.dragItemIntoScene()
+        self.resizePlacedItem()
 
     def testB(self):
         print('b')
@@ -58,4 +70,3 @@
 
 if __name__ == '__main__':
     unittest.main()
-