From c0701a97e26e3c79de91675db51bb7f068f3dfa6 2009-05-25 12:55:35 From: florianlink Date: 2009-05-25 12:55:35 Subject: [PATCH] improved enum overload handling, added test that verifies QColor int and GlobalColor constructor overloads git-svn-id: svn://svn.code.sf.net/p/pythonqt/code/trunk@94 ea8d5007-eb21-0410-b261-ccb3ea6e24a9 --- diff --git a/tests/PythonQtTests.cpp b/tests/PythonQtTests.cpp index 94e9e21..ddac5a4 100644 --- a/tests/PythonQtTests.cpp +++ b/tests/PythonQtTests.cpp @@ -430,6 +430,10 @@ void PythonQtTestApi::testQtNamespace() QVERIFY(_main.getVariable("PythonQt.QtCore.Qt.red").toInt()==Qt::red); QVERIFY(_main.getVariable("PythonQt.QtCore.Qt.FlatCap").toInt()==Qt::FlatCap); QVERIFY(PythonQtObjectPtr(_main.getVariable("PythonQt.QtCore.Qt.escape"))); + // check for an enum type wrapper + QVERIFY(PythonQtObjectPtr(_main.getVariable("PythonQt.QtCore.Qt.AlignmentFlag"))); + // check for a flags type wrapper + QVERIFY(PythonQtObjectPtr(_main.getVariable("PythonQt.QtCore.Qt.Alignment"))); } void PythonQtTestApi::testQColorDecorators() @@ -447,6 +451,11 @@ void PythonQtTestApi::testQColorDecorators() QEXPECT_FAIL("", "Testing non-existing constructor", Continue); QVERIFY(colorClass.call(QVariantList() << 1 << 2) != QVariant()); + // check that enum overload is taken over int + QVERIFY(qVariantValue(_main.evalScript("PythonQt.Qt.QColor(PythonQt.Qt.Qt.red)" ,Py_eval_input)) == QColor(Qt::red)); + // check that int overload is taken over enum + QVERIFY(qVariantValue(_main.evalScript("PythonQt.Qt.QColor(0x112233)" ,Py_eval_input)) == QColor(0x112233)); + // check for decorated Cmyk enum value QVERIFY(colorClass.getVariable("Cmyk").toInt() == QColor::Cmyk); PythonQtObjectPtr staticMethod = colorClass.getVariable("fromRgb");