[Development] Header diff for QtTest

Thiago Macieira thiago.macieira at intel.com
Wed Jun 26 22:50:15 CEST 2013


diff --git a/src/testlib/qbenchmark.h b/src/testlib/qbenchmark.h
index c9ce198..ea5023c 100644
--- a/src/testlib/qbenchmark.h
+++ b/src/testlib/qbenchmark.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -45,8 +45,6 @@
 #include <QtTest/qtest_global.h>
 #include <QtTest/qbenchmarkmetric.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -58,7 +56,7 @@ namespace QTest
 //  -------------
 //
 // The QBenchmarkIterationController class is not a part of the
-// QTestlib API. It exists purely as an implementation detail.
+// Qt Test API. It exists purely as an implementation detail.
 //
 //
 class Q_TESTLIB_EXPORT QBenchmarkIterationController
@@ -94,6 +92,4 @@ namespace QTest
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QBENCHMARK_H
diff --git a/src/testlib/qbenchmarkmetric.h b/src/testlib/qbenchmarkmetric.h
index 769e362..448df3f 100644
--- a/src/testlib/qbenchmarkmetric.h
+++ b/src/testlib/qbenchmarkmetric.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtTest/qtest_global.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -60,13 +58,32 @@ enum QBenchmarkMetric {
     InstructionReads,
     Events,
     WalltimeNanoseconds,
-    BytesAllocated
+    BytesAllocated,
+    CPUMigrations,
+    CPUCycles,
+    BusCycles,
+    StalledCycles,
+    Instructions,
+    BranchInstructions,
+    BranchMisses,
+    CacheReferences,
+    CacheReads,
+    CacheWrites,
+    CachePrefetches,
+    CacheMisses,
+    CacheReadMisses,
+    CacheWriteMisses,
+    CachePrefetchMisses,
+    ContextSwitches,
+    PageFaults,
+    MinorPageFaults,
+    MajorPageFaults,
+    AlignmentFaults,
+    EmulationFaults
 };
 
 }
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QBENCHMARK_H
diff --git a/src/testlib/qsignalspy.h b/src/testlib/qsignalspy.h
index b8e542a..72a5df1 100644
--- a/src/testlib/qsignalspy.h
+++ b/src/testlib/qsignalspy.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -50,8 +50,6 @@
 #include <QtCore/qvector.h>
 #include <QtTest/qtesteventloop.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -97,7 +95,7 @@ public:
             return;
         }
         sig = ba;
-        initArgs(mo->method(sigIndex));
+        initArgs(mo->method(sigIndex), obj);
     }
 
     inline bool isValid() const { return !sig.isEmpty(); }
@@ -131,10 +129,23 @@ public:
 private:
     void initArgs(const QMetaMethod &member)
     {
+        initArgs(member, 0);
+    }
+
+    void initArgs(const QMetaMethod &member, const QObject *obj)
+    {
         const QList<QByteArray> params = member.parameterTypes();
         args.reserve(params.size());
         for (int i = 0; i < params.count(); ++i) {
-            const int tp = QMetaType::type(params.at(i).constData());
+            int tp = QMetaType::type(params.at(i).constData());
+            if (tp == QMetaType::UnknownType && obj) {
+                void *argv[] = { &tp, &i };
+                QMetaObject::metacall(const_cast<QObject*>(obj),
+                                      QMetaObject::RegisterMethodArgumentMetaType,
+                                      member.methodIndex(), argv);
+                if (tp == -1)
+                    tp = QMetaType::UnknownType;
+            }
             if (tp == QMetaType::UnknownType) {
                 Q_ASSERT(tp != QMetaType::Void); // void parameter => metaobject is corrupt
                 qWarning("Don't know how to handle '%s', use qRegisterMetaType to register it.",
@@ -172,6 +183,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index a38b656..ac1d6cc 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -60,8 +60,6 @@
 #include <QtCore/qrect.h>
 
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -70,12 +68,12 @@ namespace QTest
 
 template<> inline char *toString(const QLatin1String &str)
 {
-    return qstrdup(str.latin1());
+    return qstrdup(qPrintable(QString(str)));
 }
 
 template<> inline char *toString(const QString &str)
 {
-    return qstrdup(str.toLatin1().constData());
+    return qstrdup(qPrintable(str));
 }
 
 template<> inline char *toString(const QByteArray &ba)
@@ -87,29 +85,29 @@ template<> inline char *toString(const QByteArray &ba)
 template<> inline char *toString(const QTime &time)
 {
     return time.isValid()
-        ? qstrdup(time.toString(QLatin1String("hh:mm:ss.zzz")).toLatin1().constData())
+        ? qstrdup(qPrintable(time.toString(QLatin1String("hh:mm:ss.zzz"))))
         : qstrdup("Invalid QTime");
 }
 
 template<> inline char *toString(const QDate &date)
 {
     return date.isValid()
-        ? qstrdup(date.toString(QLatin1String("yyyy/MM/dd")).toLatin1().constData())
+        ? qstrdup(qPrintable(date.toString(QLatin1String("yyyy/MM/dd"))))
         : qstrdup("Invalid QDate");
 }
 
 template<> inline char *toString(const QDateTime &dateTime)
 {
     return dateTime.isValid()
-        ? qstrdup((dateTime.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz")) +
-                  (dateTime.timeSpec() == Qt::LocalTime ? QLatin1String("[local time]") : QLatin1String("[UTC]"))).toLatin1().constData())
+        ? qstrdup(qPrintable(dateTime.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz")) +
+                             (dateTime.timeSpec() == Qt::LocalTime ? QLatin1String("[local time]") : QLatin1String("[UTC]"))))
         : qstrdup("Invalid QDateTime");
 }
 #endif // QT_NO_DATESTRING
 
 template<> inline char *toString(const QChar &c)
 {
-    return qstrdup(QString::fromLatin1("QChar: '%1' (0x%2)").arg(c).arg(QString::number(static_cast<int>(c.unicode()), 16)).toLatin1().constData());
+    return qstrdup(qPrintable(QString::fromLatin1("QChar: '%1' (0x%2)").arg(c).arg(QString::number(static_cast<int>(c.unicode()), 16))));
 }
 
 template<> inline char *toString(const QPoint &p)
@@ -145,7 +143,7 @@ template<> inline char *toString(const QRectF &s)
 template<> inline char *toString(const QUrl &uri)
 {
     if (!uri.isValid())
-        return qstrdup(QByteArray("Invalid URL: " + uri.errorString().toLatin1()).constData());
+        return qstrdup(qPrintable(QStringLiteral("Invalid URL: ") + uri.errorString()));
     return qstrdup(uri.toEncoded().constData());
 }
 
@@ -161,7 +159,7 @@ template<> inline char *toString(const QVariant &v)
         if (!v.isNull()) {
             vstring.append(',');
             if (v.canConvert(QVariant::String)) {
-                vstring.append(qvariant_cast<QString>(v).toLatin1());
+                vstring.append(qvariant_cast<QString>(v).toLocal8Bit());
             }
             else {
                 vstring.append("<value not representable as string>");
@@ -186,9 +184,9 @@ inline bool qCompare(QLatin1String const &t1, QString const &t2, const char *act
     return qCompare(QString(t1), t2, actual, expected, file, line);
 }
 
-template<>
-inline bool qCompare(QStringList const &t1, QStringList const &t2,
-                    const char *actual, const char *expected, const char *file, int line)
+template <typename T>
+inline bool qCompare(QList<T> const &t1, QList<T> const &t2, const char *actual, const char *expected,
+                    const char *file, int line)
 {
     char msg[1024];
     msg[0] = '\0';
@@ -196,23 +194,30 @@ inline bool qCompare(QStringList const &t1, QStringList const &t2,
     const int actualSize = t1.count();
     const int expectedSize = t2.count();
     if (actualSize != expectedSize) {
-        qsnprintf(msg, sizeof(msg), "Compared QStringLists have different sizes.\n"
+        qsnprintf(msg, sizeof(msg), "Compared lists have different sizes.\n"
                   "   Actual   (%s) size: '%d'\n"
                   "   Expected (%s) size: '%d'", actual, actualSize, expected, expectedSize);
         isOk = false;
     }
     for (int i = 0; isOk && i < actualSize; ++i) {
-        if (t1.at(i) != t2.at(i)) {
-            qsnprintf(msg, sizeof(msg), "Compared QStringLists differ at index %d.\n"
+        if (!(t1.at(i) == t2.at(i))) {
+            qsnprintf(msg, sizeof(msg), "Compared lists differ at index %d.\n"
                       "   Actual   (%s): '%s'\n"
-                      "   Expected (%s): '%s'", i, actual, t1.at(i).toLatin1().constData(),
-                      expected, t2.at(i).toLatin1().constData());
+                      "   Expected (%s): '%s'", i, actual, toString(t1.at(i)),
+                      expected, toString(t2.at(i)));
             isOk = false;
         }
     }
     return compare_helper(isOk, msg, 0, 0, actual, expected, file, line);
 }
 
+template <>
+inline bool qCompare(QStringList const &t1, QStringList const &t2, const char *actual, const char *expected,
+                            const char *file, int line)
+{
+    return qCompare<QString>(t1, t2, actual, expected, file, line);
+}
+
 template <typename T>
 inline bool qCompare(QFlags<T> const &t1, T const &t2, const char *actual, const char *expected,
                     const char *file, int line)
@@ -227,6 +232,48 @@ inline bool qCompare(QFlags<T> const &t1, int const &t2, const char *actual, con
     return qCompare(int(t1), t2, actual, expected, file, line);
 }
 
+template<>
+inline bool qCompare(qint64 const &t1, qint32 const &t2, const char *actual,
+                    const char *expected, const char *file, int line)
+{
+    return qCompare(t1, static_cast<qint64>(t2), actual, expected, file, line);
+}
+
+template<>
+inline bool qCompare(qint64 const &t1, quint32 const &t2, const char *actual,
+                    const char *expected, const char *file, int line)
+{
+    return qCompare(t1, static_cast<qint64>(t2), actual, expected, file, line);
+}
+
+template<>
+inline bool qCompare(quint64 const &t1, quint32 const &t2, const char *actual,
+                    const char *expected, const char *file, int line)
+{
+    return qCompare(t1, static_cast<quint64>(t2), actual, expected, file, line);
+}
+
+template<>
+inline bool qCompare(qint32 const &t1, qint64 const &t2, const char *actual,
+                    const char *expected, const char *file, int line)
+{
+    return qCompare(static_cast<qint64>(t1), t2, actual, expected, file, line);
+}
+
+template<>
+inline bool qCompare(quint32 const &t1, qint64 const &t2, const char *actual,
+                    const char *expected, const char *file, int line)
+{
+    return qCompare(static_cast<qint64>(t1), t2, actual, expected, file, line);
+}
+
+template<>
+inline bool qCompare(quint32 const &t1, quint64 const &t2, const char *actual,
+                    const char *expected, const char *file, int line)
+{
+    return qCompare(static_cast<quint64>(t1), t2, actual, expected, file, line);
+}
+
 }
 QT_END_NAMESPACE
 
@@ -294,6 +341,4 @@ int main(int argc, char *argv[]) \
     return QTest::qExec(&tc, argc, argv); \
 }
 
-QT_END_HEADER
-
 #endif
diff --git a/src/testlib/qtest_global.h b/src/testlib/qtest_global.h
index 464810d..ac5a0b2 100644
--- a/src/testlib/qtest_global.h
+++ b/src/testlib/qtest_global.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -76,6 +74,4 @@ namespace QTest
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/testlib/qtest_gui.h b/src/testlib/qtest_gui.h
index 66e65f7..a9ac777 100644
--- a/src/testlib/qtest_gui.h
+++ b/src/testlib/qtest_gui.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -69,8 +69,6 @@
 #pragma qt_no_master_include
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -149,6 +147,4 @@ inline bool qCompare(QPixmap const &t1, QPixmap const &t2, const char *actual, c
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/testlib/qtest_widgets.h b/src/testlib/qtest_widgets.h
index ac3f032..1161b84 100644
--- a/src/testlib/qtest_widgets.h
+++ b/src/testlib/qtest_widgets.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -57,11 +57,9 @@
 #pragma qt_no_master_include
 #endif
 
-QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 QT_END_NAMESPACE
-QT_END_HEADER
 
 #endif
 
diff --git a/src/testlib/qtestaccessible.h b/src/testlib/qtestaccessible.h
index 2642ee2..f27651c 100644
--- a/src/testlib/qtestaccessible.h
+++ b/src/testlib/qtestaccessible.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -47,6 +47,8 @@
 #pragma qt_no_master_include
 #endif
 
+#include <QtCore/qglobal.h>
+
 #ifndef QT_NO_ACCESSIBILITY
 
 #define QVERIFY_EVENT(event) \
@@ -56,8 +58,8 @@
 #include <QtCore/qdebug.h>
 #include <QtGui/qaccessible.h>
 #include <QtGui/qguiapplication.h>
-
-QT_BEGIN_HEADER
+#include <QtTest/qtest_global.h>
+#include <QtTest/qtestsystem.h>
 
 QT_BEGIN_NAMESPACE
 
@@ -254,7 +256,7 @@ private:
         str << "Event " << needle->object() <<  ", type: "
            << needle->type() << ", child: " << needle->child()
            <<  " not found at head of event list of size " << haystack.size() << " :";
-        foreach (const QAccessibleEvent *e, haystack)
+        Q_FOREACH (const QAccessibleEvent *e, haystack)
             str << ' ' << e->object() << ", type: "
                 << e->type() << ", child: " << e->child();
         return rc;
@@ -264,7 +266,5 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QT_NO_ACCESSIBILITY
 #endif // QTESTACCESSIBLE_H
diff --git a/src/testlib/qtestassert.h b/src/testlib/qtestassert.h
index 00df2fa..c694253 100644
--- a/src/testlib/qtestassert.h
+++ b/src/testlib/qtestassert.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -44,8 +44,6 @@
 
 #include <QtCore/qglobal.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -55,6 +53,4 @@ QT_BEGIN_NAMESPACE
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h
index 8529791..6b5e7a5 100644
--- a/src/testlib/qtestcase.h
+++ b/src/testlib/qtestcase.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -51,8 +51,6 @@
 
 #include <string.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -249,7 +247,7 @@ namespace QTest
     Q_TESTLIB_EXPORT bool compare_string_helper(const char *t1, const char *t2, const char *actual,
                                       const char *expected, const char *file, int line);
 
-#ifndef qdoc
+#ifndef Q_QDOC
     QTEST_COMPARE_DECL(short)
     QTEST_COMPARE_DECL(ushort)
     QTEST_COMPARE_DECL(int)
@@ -352,6 +350,4 @@ namespace QTest
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/testlib/qtestdata.h b/src/testlib/qtestdata.h
index 1f77c22..d1bc3e7 100644
--- a/src/testlib/qtestdata.h
+++ b/src/testlib/qtestdata.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -47,8 +47,6 @@
 #include <QtCore/qmetatype.h>
 #include <QtCore/qstring.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -99,6 +97,4 @@ inline QTestData &operator<<(QTestData &data, const QStringBuilder<A, B> &value)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/testlib/qtestevent.h b/src/testlib/qtestevent.h
index e7e9a35..a96cfa7 100644
--- a/src/testlib/qtestevent.h
+++ b/src/testlib/qtestevent.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -58,8 +58,6 @@
 
 #include <stdlib.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -227,6 +225,4 @@ QT_END_NAMESPACE
 
 Q_DECLARE_METATYPE(QTestEventList)
 
-QT_END_HEADER
-
 #endif
diff --git a/src/testlib/qtesteventloop.h b/src/testlib/qtesteventloop.h
index c8184e5..b70954c 100644
--- a/src/testlib/qtesteventloop.h
+++ b/src/testlib/qtesteventloop.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -49,8 +49,6 @@
 #include <QtCore/qobject.h>
 #include <QtCore/qpointer.h>
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -131,6 +129,4 @@ inline void QTestEventLoop::timerEvent(QTimerEvent *e)
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/testlib/qtestkeyboard.h b/src/testlib/qtestkeyboard.h
index 3be4a77..8788067 100644
--- a/src/testlib/qtestkeyboard.h
+++ b/src/testlib/qtestkeyboard.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -62,8 +62,6 @@
 #include <QtWidgets/qapplication.h>
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 Q_GUI_EXPORT void qt_handleKeyEvent(QWindow *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1);
@@ -298,6 +296,4 @@ namespace QTest
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QTESTKEYBOARD_H
diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h
index cb61c67..4d70aff 100644
--- a/src/testlib/qtestmouse.h
+++ b/src/testlib/qtestmouse.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -54,14 +54,13 @@
 #include <QtCore/qpoint.h>
 #include <QtCore/qstring.h>
 #include <QtGui/qevent.h>
+#include <QtGui/qwindow.h>
 
 #ifdef QT_WIDGETS_LIB
 #include <QtWidgets/qapplication.h>
 #include <QtWidgets/qwidget.h>
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier);
@@ -85,6 +84,9 @@ namespace QTest
         QTEST_ASSERT(window);
         extern int Q_TESTLIB_EXPORT defaultMouseDelay();
 
+        if (!window->geometry().contains(pos))
+            QTest::qWarn("Mouse event occurs outside of target window.");
+
          static Qt::MouseButton lastButton = Qt::NoButton;
 
         if (delay == -1 || delay < defaultMouseDelay())
@@ -227,6 +229,4 @@ namespace QTest
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QTESTMOUSE_H
diff --git a/src/testlib/qtestspontaneevent.h b/src/testlib/qtestspontaneevent.h
index 04ce57d..e299981 100644
--- a/src/testlib/qtestspontaneevent.h
+++ b/src/testlib/qtestspontaneevent.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -49,8 +49,6 @@
 #pragma qt_no_master_include
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 
@@ -73,7 +71,7 @@ public:
 class QSpontaneKeyEvent
 {
 public:
-    void setSpontaneous() { spont = 1; }
+    void setSpontaneous() { spont = 1; Q_UNUSED(posted) Q_UNUSED(m_accept) Q_UNUSED(reserved) }
     bool spontaneous() { return spont; }
     virtual void dummyFunc() {}
     virtual ~QSpontaneKeyEvent() {}
@@ -112,6 +110,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h
index dd60aae..2a719e9 100644
--- a/src/testlib/qtestsystem.h
+++ b/src/testlib/qtestsystem.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -52,8 +52,6 @@
 #  include <QtWidgets/QWidget>
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 namespace QTest
@@ -72,7 +70,7 @@ namespace QTest
     }
 
 #ifdef QT_GUI_LIB
-    inline static bool qWaitForWindowActive(QWindow *window, int timeout = 1000)
+    inline static bool qWaitForWindowActive(QWindow *window, int timeout = 5000)
     {
         QElapsedTimer timer;
         timer.start();
@@ -101,7 +99,7 @@ namespace QTest
         return window->isActive();
     }
 
-    inline static bool qWaitForWindowExposed(QWindow *window, int timeout = 1000)
+    inline static bool qWaitForWindowExposed(QWindow *window, int timeout = 5000)
     {
         QElapsedTimer timer;
         timer.start();
@@ -145,7 +143,5 @@ namespace QTest
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif
 
diff --git a/src/testlib/qtesttouch.h b/src/testlib/qtesttouch.h
index 0b4b558..9a661b4 100644
--- a/src/testlib/qtesttouch.h
+++ b/src/testlib/qtesttouch.h
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
 ** Contact: http://www.qt-project.org/legal
 **
 ** This file is part of the QtTest module of the Qt Toolkit.
@@ -53,12 +53,11 @@
 #include <QtTest/qtestspontaneevent.h>
 #include <QtCore/qmap.h>
 #include <QtGui/qevent.h>
+#include <QtGui/qwindow.h>
 #ifdef QT_WIDGETS_LIB
 #include <QtWidgets/qwidget.h>
 #endif
 
-QT_BEGIN_HEADER
-
 QT_BEGIN_NAMESPACE
 
 Q_GUI_EXPORT  void qt_handleTouchEvent(QWindow *w, QTouchDevice *device,
@@ -233,6 +232,4 @@ private:
 
 QT_END_NAMESPACE
 
-QT_END_HEADER
-
 #endif // QTESTTOUCH_H



More information about the Development mailing list