Skip to content

Commit 2a70a30

Browse files
committed
added new tests
1 parent 5dd37f4 commit 2a70a30

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

tests/PythonQtTests.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,22 @@ void PythonQtTestSlotCalling::testQListSlotCalls()
226226

227227
QVERIFY(_helper->runScript("if obj.getQListDayOfWeek((PythonQt.QtCore.Qt.Monday, PythonQt.QtCore.Qt.Friday))==(PythonQt.QtCore.Qt.Monday, PythonQt.QtCore.Qt.Friday): obj.setPassed();\n"));
228228

229+
QVERIFY(_helper->runScript("if obj.getQPair((1.2, PythonQt.QtGui.QColor(PythonQt.QtCore.Qt.red)))==(1.2, PythonQt.QtGui.QColor(PythonQt.QtCore.Qt.red)): obj.setPassed();\n"));
230+
QVERIFY(_helper->runScript("if obj.getQPairVariant((1.2, PythonQt.QtGui.QColor(PythonQt.QtCore.Qt.red)))==(1.2, PythonQt.QtGui.QColor(PythonQt.QtCore.Qt.red)): obj.setPassed();\n"));
231+
232+
QVERIFY(_helper->runScript("if obj.getQVectorQPair1(((1.2, PythonQt.QtGui.QColor(PythonQt.QtCore.Qt.red)),))==((1.2, PythonQt.QtGui.QColor(PythonQt.QtCore.Qt.red)),): obj.setPassed();\n"));
233+
QVERIFY(_helper->runScript("if obj.getQVectorQPair2(((1.2, PythonQt.QtGui.QColor(PythonQt.QtCore.Qt.red)),))==((1.2, PythonQt.QtGui.QColor(PythonQt.QtCore.Qt.red)),): obj.setPassed();\n"));
234+
229235
QVERIFY(_helper->runScript("if obj.getQListQSize()==(PythonQt.QtCore.QSize(1,2), PythonQt.QtCore.QSize(3,4)): obj.setPassed();\n"));
230236
QVERIFY(_helper->runScript("if obj.getQListQSize((PythonQt.QtCore.QSize(1,2), PythonQt.QtCore.QSize(3,4)))==(PythonQt.QtCore.QSize(1,2), PythonQt.QtCore.QSize(3,4)): obj.setPassed();\n"));
231237
}
232238

239+
void PythonQtTestSlotCalling::testQMapSlotCalls()
240+
{
241+
QVERIFY(_helper->runScript("if obj.getQMapIntVariant({1:'test', 47:48, 49:47.11})=={1:'test', 47:48, 49:47.11}: obj.setPassed();\n"));
242+
QVERIFY(_helper->runScript("if obj.getQMapIntString({1:'test', 47:'a', 49:'bcd'})=={1:'test', 47:'a', 49:'bcd'}: obj.setPassed();\n"));
243+
}
244+
233245
void PythonQtTestSlotCalling::testObjectSlotCalls()
234246
{
235247
QVERIFY(_helper->runScript("if obj.getQObject(obj)==obj: obj.setPassed();\n"));

tests/PythonQtTests.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ private Q_SLOTS:
319319
void testCPPSlotCalls();
320320
void testQVariantSlotCalls();
321321
void testQListSlotCalls();
322+
void testQMapSlotCalls();
322323
void testObjectSlotCalls();
323324
void testMultiArgsSlotCall();
324325
void testPyObjectSlotCall();
@@ -395,6 +396,16 @@ public Q_SLOTS:
395396
QList<QSize> getQListQSize(const QList<QSize>& list) { _called = true; return list; }
396397

397398
QList<Qt::DayOfWeek> getQListDayOfWeek(const QList<Qt::DayOfWeek>& days) { _called = true; return days; }
399+
400+
QMap<int, QVariant> getQMapIntVariant(const QMap<int, QVariant>& map) { _called = true; return map; }
401+
QMap<int, QString> getQMapIntString(const QMap<int, QString>& map) { _called = true; return map; }
402+
403+
QVector<QPair<double, QColor > > getQVectorQPair1(const QVector<QPair<double, QColor > > &list) { _called = true; return list; }
404+
QVector<QPair<qreal, QColor > > getQVectorQPair2(const QVector<QPair<qreal, QColor > > &list) { _called = true; return list; }
405+
406+
QPair<double, QColor> getQPair(const QPair<double, QColor>& pair) { _called = true; return pair; }
407+
408+
QPair<double, QVariant> getQPairVariant(const QPair<double, QVariant>& pair) { _called = true; return pair; }
398409

399410
// QColor as representative for C++ value classes
400411
QColor getQColor1(const QColor& var) { _called = true; return var; }

0 commit comments

Comments
 (0)