##// END OF EJS Templates
improved enum overload handling, added test that verifies QColor int and GlobalColor constructor overloads...
florianlink -
r58:c0701a97e26e
parent child
Show More
@@ -430,6 +430,10 void PythonQtTestApi::testQtNamespace()
430 QVERIFY(_main.getVariable("PythonQt.QtCore.Qt.red").toInt()==Qt::red);
430 QVERIFY(_main.getVariable("PythonQt.QtCore.Qt.red").toInt()==Qt::red);
431 QVERIFY(_main.getVariable("PythonQt.QtCore.Qt.FlatCap").toInt()==Qt::FlatCap);
431 QVERIFY(_main.getVariable("PythonQt.QtCore.Qt.FlatCap").toInt()==Qt::FlatCap);
432 QVERIFY(PythonQtObjectPtr(_main.getVariable("PythonQt.QtCore.Qt.escape")));
432 QVERIFY(PythonQtObjectPtr(_main.getVariable("PythonQt.QtCore.Qt.escape")));
433 // check for an enum type wrapper
434 QVERIFY(PythonQtObjectPtr(_main.getVariable("PythonQt.QtCore.Qt.AlignmentFlag")));
435 // check for a flags type wrapper
436 QVERIFY(PythonQtObjectPtr(_main.getVariable("PythonQt.QtCore.Qt.Alignment")));
433 }
437 }
434
438
435 void PythonQtTestApi::testQColorDecorators()
439 void PythonQtTestApi::testQColorDecorators()
@@ -447,6 +451,11 void PythonQtTestApi::testQColorDecorators()
447 QEXPECT_FAIL("", "Testing non-existing constructor", Continue);
451 QEXPECT_FAIL("", "Testing non-existing constructor", Continue);
448 QVERIFY(colorClass.call(QVariantList() << 1 << 2) != QVariant());
452 QVERIFY(colorClass.call(QVariantList() << 1 << 2) != QVariant());
449
453
454 // check that enum overload is taken over int
455 QVERIFY(qVariantValue<QColor>(_main.evalScript("PythonQt.Qt.QColor(PythonQt.Qt.Qt.red)" ,Py_eval_input)) == QColor(Qt::red));
456 // check that int overload is taken over enum
457 QVERIFY(qVariantValue<QColor>(_main.evalScript("PythonQt.Qt.QColor(0x112233)" ,Py_eval_input)) == QColor(0x112233));
458
450 // check for decorated Cmyk enum value
459 // check for decorated Cmyk enum value
451 QVERIFY(colorClass.getVariable("Cmyk").toInt() == QColor::Cmyk);
460 QVERIFY(colorClass.getVariable("Cmyk").toInt() == QColor::Cmyk);
452 PythonQtObjectPtr staticMethod = colorClass.getVariable("fromRgb");
461 PythonQtObjectPtr staticMethod = colorClass.getVariable("fromRgb");
General Comments 0
You need to be logged in to leave comments. Login now