summaryrefslogtreecommitdiffstats
path: root/tests/auto/qmetaobject
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2010-03-02 10:03:12 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2010-03-02 13:22:45 (GMT)
commit03daf059647c0a0222e8774b0a083f58c8e64934 (patch)
tree62f7bda5a497c508d98598a4ae4ef8d2fd0157c9 /tests/auto/qmetaobject
parenta140e37fab6a1d028fd1b751a98774dacb4f1a89 (diff)
downloadQt-03daf059647c0a0222e8774b0a083f58c8e64934.zip
Qt-03daf059647c0a0222e8774b0a083f58c8e64934.tar.gz
Qt-03daf059647c0a0222e8774b0a083f58c8e64934.tar.bz2
QMetaType: Now we can register typedefs.
Task-number: QTBUG-6833 Task-number: QTBUG-937 Reviewed-by: Brad Reviewed-by: Kent Hansen
Diffstat (limited to 'tests/auto/qmetaobject')
-rw-r--r--tests/auto/qmetaobject/tst_qmetaobject.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp
index bd54975..bb4a0d2 100644
--- a/tests/auto/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp
@@ -157,6 +157,7 @@ private slots:
void invokeQueuedMetaMember();
void invokeCustomTypes();
void invokeMetaConstructor();
+ void invokeTypedefTypes();
void qtMetaObjectInheritance();
void normalizedSignature_data();
void normalizedSignature();
@@ -598,6 +599,8 @@ struct MyType
int i1, i2, i3;
};
+typedef QString CustomString;
+
class QtTestCustomObject: public QObject
{
Q_OBJECT
@@ -607,6 +610,9 @@ public:
public slots:
void sl1(MyType myType);
+signals:
+ void sig_custom(const CustomString &string);
+
public:
int sum;
};
@@ -664,6 +670,20 @@ void tst_QMetaObject::invokeMetaConstructor()
}
}
+void tst_QMetaObject::invokeTypedefTypes()
+{
+ qRegisterMetaType<CustomString>("CustomString");
+ QtTestCustomObject obj;
+ QSignalSpy spy(&obj, SIGNAL(sig_custom(CustomString)));
+
+ QCOMPARE(spy.count(), 0);
+ CustomString arg("hello");
+ QVERIFY(QMetaObject::invokeMethod(&obj, "sig_custom", Q_ARG(CustomString, arg)));
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.at(0).count(), 1);
+ QCOMPARE(spy.at(0).at(0), QVariant(arg));
+}
+
void tst_QMetaObject::normalizedSignature_data()
{
QTest::addColumn<QString>("signature");