1728 QCOMPARE(o.invoked(), 18); |
1733 QCOMPARE(o.invoked(), 18); |
1729 QCOMPARE(o.actuals().count(), 1); |
1734 QCOMPARE(o.actuals().count(), 1); |
1730 QCOMPARE(o.actuals().at(0), QVariant(9)); |
1735 QCOMPARE(o.actuals().at(0), QVariant(9)); |
1731 } |
1736 } |
1732 |
1737 |
|
1738 // QTBUG-13047 (check that you can pass registered object types as args) |
|
1739 void tst_qdeclarativeecmascript::invokableObjectArg() |
|
1740 { |
|
1741 QDeclarativeComponent component(&engine, TEST_FILE("invokableObjectArg.qml")); |
|
1742 |
|
1743 QObject *o = component.create(); |
|
1744 QVERIFY(o); |
|
1745 MyQmlObject *qmlobject = qobject_cast<MyQmlObject *>(o); |
|
1746 QVERIFY(qmlobject); |
|
1747 QCOMPARE(qmlobject->myinvokableObject, qmlobject); |
|
1748 |
|
1749 delete o; |
|
1750 } |
|
1751 |
|
1752 // QTBUG-13047 (check that you can return registered object types from methods) |
|
1753 void tst_qdeclarativeecmascript::invokableObjectRet() |
|
1754 { |
|
1755 QDeclarativeComponent component(&engine, TEST_FILE("invokableObjectRet.qml")); |
|
1756 |
|
1757 QObject *o = component.create(); |
|
1758 QVERIFY(o); |
|
1759 QCOMPARE(o->property("test").toBool(), true); |
|
1760 delete o; |
|
1761 } |
|
1762 |
1733 // QTBUG-5675 |
1763 // QTBUG-5675 |
1734 void tst_qdeclarativeecmascript::listToVariant() |
1764 void tst_qdeclarativeecmascript::listToVariant() |
1735 { |
1765 { |
1736 QDeclarativeComponent component(&engine, TEST_FILE("listToVariant.qml")); |
1766 QDeclarativeComponent component(&engine, TEST_FILE("listToVariant.qml")); |
1737 |
1767 |
2528 QVERIFY(o != 0); |
2558 QVERIFY(o != 0); |
2529 QCOMPARE(o->property("test").toBool(), true); |
2559 QCOMPARE(o->property("test").toBool(), true); |
2530 delete o; |
2560 delete o; |
2531 } |
2561 } |
2532 |
2562 |
|
2563 // Reading and writing non-scriptable properties should fail |
|
2564 void tst_qdeclarativeecmascript::nonscriptable() |
|
2565 { |
|
2566 QDeclarativeComponent component(&engine, TEST_FILE("nonscriptable.qml")); |
|
2567 QObject *o = component.create(); |
|
2568 QVERIFY(o != 0); |
|
2569 QCOMPARE(o->property("readOk").toBool(), true); |
|
2570 QCOMPARE(o->property("writeOk").toBool(), true); |
|
2571 delete o; |
|
2572 } |
|
2573 |
|
2574 // deleteLater() should not be callable from QML |
|
2575 void tst_qdeclarativeecmascript::deleteLater() |
|
2576 { |
|
2577 QDeclarativeComponent component(&engine, TEST_FILE("deleteLater.qml")); |
|
2578 QObject *o = component.create(); |
|
2579 QVERIFY(o != 0); |
|
2580 QCOMPARE(o->property("test").toBool(), true); |
|
2581 delete o; |
|
2582 } |
|
2583 |
|
2584 void tst_qdeclarativeecmascript::in() |
|
2585 { |
|
2586 QDeclarativeComponent component(&engine, TEST_FILE("in.qml")); |
|
2587 QObject *o = component.create(); |
|
2588 QVERIFY(o != 0); |
|
2589 QCOMPARE(o->property("test1").toBool(), true); |
|
2590 QCOMPARE(o->property("test2").toBool(), true); |
|
2591 delete o; |
|
2592 } |
2533 |
2593 |
2534 QTEST_MAIN(tst_qdeclarativeecmascript) |
2594 QTEST_MAIN(tst_qdeclarativeecmascript) |
2535 |
2595 |
2536 #include "tst_qdeclarativeecmascript.moc" |
2596 #include "tst_qdeclarativeecmascript.moc" |