@@ -125,6 +125,16 void PythonQtTestSlotCalling::testInheritance() { | |||
|
125 | 125 | |
|
126 | 126 | } |
|
127 | 127 | |
|
128 | void PythonQtTestSlotCalling::testAutoConversion() { | |
|
129 | QVERIFY(_helper->runScript("if obj.setAutoConvertColor(PythonQt.QtCore.Qt.red)==PythonQt.Qt.QColor(PythonQt.QtCore.Qt.red): obj.setPassed();\n")); | |
|
130 | QVERIFY(_helper->runScript("if obj.setAutoConvertBrush(PythonQt.QtCore.Qt.red)==PythonQt.Qt.QBrush(PythonQt.QtCore.Qt.red): obj.setPassed();\n")); | |
|
131 | QVERIFY(_helper->runScript("if obj.setAutoConvertPen(PythonQt.QtCore.Qt.red)==PythonQt.Qt.QPen(PythonQt.QtCore.Qt.red): obj.setPassed();\n")); | |
|
132 | QVERIFY(_helper->runScript("if obj.setAutoConvertBrush(PythonQt.Qt.QColor(PythonQt.QtCore.Qt.red))==PythonQt.Qt.QBrush(PythonQt.QtCore.Qt.red): obj.setPassed();\n")); | |
|
133 | QVERIFY(_helper->runScript("if obj.setAutoConvertPen(PythonQt.Qt.QColor(PythonQt.QtCore.Qt.red))==PythonQt.Qt.QPen(PythonQt.QtCore.Qt.red): obj.setPassed();\n")); | |
|
134 | QVERIFY(_helper->runScript("if obj.setAutoConvertCursor(PythonQt.Qt.QCursor(PythonQt.QtCore.Qt.UpArrowCursor)).shape()==PythonQt.Qt.QCursor(PythonQt.QtCore.Qt.UpArrowCursor).shape(): obj.setPassed();\n")); | |
|
135 | QVERIFY(_helper->runScript("if obj.setAutoConvertCursor(PythonQt.QtCore.Qt.UpArrowCursor).shape()==PythonQt.Qt.QCursor(PythonQt.QtCore.Qt.UpArrowCursor).shape(): obj.setPassed();\n")); | |
|
136 | } | |
|
137 | ||
|
128 | 138 | void PythonQtTestSlotCalling::testNoArgSlotCall() |
|
129 | 139 | { |
|
130 | 140 | QVERIFY(_helper->runScript("obj.testNoArg(); obj.setPassed();\n")); |
@@ -436,6 +446,12 void PythonQtTestApi::testQtNamespace() | |||
|
436 | 446 | QVERIFY(PythonQtObjectPtr(_main.getVariable("PythonQt.QtCore.Qt.Alignment"))); |
|
437 | 447 | } |
|
438 | 448 | |
|
449 | void PythonQtTestApi::testConnects() | |
|
450 | { | |
|
451 | // QVERIFY(qVariantValue<QColor>(_main.evalScript("PythonQt.Qt.QColor(PythonQt.Qt.Qt.red)" ,Py_eval_input)) == QColor(Qt::red)); | |
|
452 | //TODO: add signal/slot connect both with QObject.connect and connect | |
|
453 | } | |
|
454 | ||
|
439 | 455 | void PythonQtTestApi::testQColorDecorators() |
|
440 | 456 | { |
|
441 | 457 | PythonQtObjectPtr colorClass = _main.getVariable("PythonQt.QtGui.QColor"); |
@@ -48,6 +48,11 | |||
|
48 | 48 | #include "PythonQtImportFileInterface.h" |
|
49 | 49 | #include "PythonQtCppWrapperFactory.h" |
|
50 | 50 | |
|
51 | #include <QPen> | |
|
52 | #include <QColor> | |
|
53 | #include <QBrush> | |
|
54 | #include <QCursor> | |
|
55 | ||
|
51 | 56 | class PythonQtTestSlotCallingHelper; |
|
52 | 57 | class PythonQtTestApiHelper; |
|
53 | 58 | class QWidget; |
@@ -65,6 +70,7 private slots: | |||
|
65 | 70 | void testImporter(); |
|
66 | 71 | void testQColorDecorators(); |
|
67 | 72 | void testQtNamespace(); |
|
73 | void testConnects(); | |
|
68 | 74 | |
|
69 | 75 | private: |
|
70 | 76 | PythonQtTestApiHelper* _helper; |
@@ -314,6 +320,7 private slots: | |||
|
314 | 320 | void testOverloadedCall(); |
|
315 | 321 | void testCppFactory(); |
|
316 | 322 | void testInheritance(); |
|
323 | void testAutoConversion(); | |
|
317 | 324 | |
|
318 | 325 | private: |
|
319 | 326 | PythonQtTestSlotCallingHelper* _helper; |
@@ -427,6 +434,11 public slots: | |||
|
427 | 434 | ClassA* createClassDAsA() { _called = true; return new ClassD; } |
|
428 | 435 | ClassB* createClassDAsB() { _called = true; return new ClassD; } |
|
429 | 436 | |
|
437 | QColor setAutoConvertColor(const QColor& color) { _called = true; return color; }; | |
|
438 | QBrush setAutoConvertBrush(const QBrush& brush) { _called = true; return brush; }; | |
|
439 | QPen setAutoConvertPen(const QPen& pen) { _called = true; return pen; }; | |
|
440 | QCursor setAutoConvertCursor(const QCursor& cursor) { _called = true; return cursor; }; | |
|
441 | ||
|
430 | 442 | private: |
|
431 | 443 | bool _passed; |
|
432 | 444 | bool _called; |
General Comments 0
You need to be logged in to leave comments.
Login now