File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -125,6 +125,16 @@ void PythonQtTestSlotCalling::testInheritance() {
125125
126126}
127127
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+
128138void PythonQtTestSlotCalling::testNoArgSlotCall ()
129139{
130140 QVERIFY (_helper->runScript (" obj.testNoArg(); obj.setPassed();\n " ));
@@ -436,6 +446,12 @@ void PythonQtTestApi::testQtNamespace()
436446 QVERIFY (PythonQtObjectPtr (_main.getVariable (" PythonQt.QtCore.Qt.Alignment" )));
437447}
438448
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+
439455void PythonQtTestApi::testQColorDecorators ()
440456{
441457 PythonQtObjectPtr colorClass = _main.getVariable (" PythonQt.QtGui.QColor" );
Original file line number Diff line number Diff line change 4848#include " PythonQtImportFileInterface.h"
4949#include " PythonQtCppWrapperFactory.h"
5050
51+ #include < QPen>
52+ #include < QColor>
53+ #include < QBrush>
54+ #include < QCursor>
55+
5156class PythonQtTestSlotCallingHelper ;
5257class PythonQtTestApiHelper ;
5358class QWidget ;
@@ -65,6 +70,7 @@ private slots:
6570 void testImporter ();
6671 void testQColorDecorators ();
6772 void testQtNamespace ();
73+ void testConnects ();
6874
6975private:
7076 PythonQtTestApiHelper* _helper;
@@ -314,6 +320,7 @@ private slots:
314320 void testOverloadedCall ();
315321 void testCppFactory ();
316322 void testInheritance ();
323+ void testAutoConversion ();
317324
318325private:
319326 PythonQtTestSlotCallingHelper* _helper;
@@ -427,6 +434,11 @@ public slots:
427434 ClassA* createClassDAsA () { _called = true ; return new ClassD; }
428435 ClassB* createClassDAsB () { _called = true ; return new ClassD; }
429436
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+
430442private:
431443 bool _passed;
432444 bool _called;
You can’t perform that action at this time.
0 commit comments