summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-02-23 11:50:01 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2011-02-23 11:50:01 (GMT)
commit5a2f7b97d564e4b8a9619cd7aa1519b4dd084ae8 (patch)
tree7886477c9d38d8c07008e12abf2eb6e05ed672e3 /src/testlib
parentca7be48b7a150952a9657d1000941fb986e5bb2b (diff)
parent33f0f832a243ee2cb188fcf27126bde6c6c883b0 (diff)
downloadQt-5a2f7b97d564e4b8a9619cd7aa1519b4dd084ae8.zip
Qt-5a2f7b97d564e4b8a9619cd7aa1519b4dd084ae8.tar.gz
Qt-5a2f7b97d564e4b8a9619cd7aa1519b4dd084ae8.tar.bz2
Merge remote-tracking branch 'origin/4.7' into qt-master-from-4.7
Conflicts: src/gui/kernel/qcocoaview_mac.mm src/s60installs/bwins/QtGuiu.def src/s60installs/eabi/QtGuiu.def src/testlib/qtestcase.cpp
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qbenchmark_p.h4
-rw-r--r--src/testlib/qtestcase.cpp42
-rw-r--r--src/testlib/qtestlog_p.h2
-rw-r--r--src/testlib/qtestresult_p.h2
-rw-r--r--src/testlib/qtesttable_p.h2
5 files changed, 43 insertions, 9 deletions
diff --git a/src/testlib/qbenchmark_p.h b/src/testlib/qbenchmark_p.h
index 9a83a1a..ace17db 100644
--- a/src/testlib/qbenchmark_p.h
+++ b/src/testlib/qbenchmark_p.h
@@ -130,7 +130,7 @@ public:
QBenchmarkGlobalData:current is created at the beginning of qExec()
and cleared at the end.
*/
-class QBenchmarkGlobalData
+class Q_TESTLIB_EXPORT QBenchmarkGlobalData
{
public:
static QBenchmarkGlobalData *current;
@@ -161,7 +161,7 @@ private:
created at the beginning of qInvokeTestMethod() and cleared at
the end.
*/
-class QBenchmarkTestMethodData
+class Q_TESTLIB_EXPORT QBenchmarkTestMethodData
{
public:
static QBenchmarkTestMethodData *current;
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 55f5fbe..22d59f9 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1014,6 +1014,10 @@ static bool isValidSlot(const QMetaMethod &sl)
return true;
}
+Q_TESTLIB_EXPORT bool printAvailableFunctions = false;
+Q_TESTLIB_EXPORT QStringList testFunctions;
+Q_TESTLIB_EXPORT QStringList testTags;
+
static void qPrintTestSlots()
{
for (int i = 0; i < QTest::currentTestObject->metaObject()->methodCount(); ++i) {
@@ -1034,7 +1038,7 @@ static int qToInt(char *str)
return l;
}
-static void qParseArgs(int argc, char *argv[])
+Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
{
const char *testOptions =
" options:\n"
@@ -1084,8 +1088,12 @@ static void qParseArgs(int argc, char *argv[])
"%s", argv[0], testOptions);
exit(0);
} else if (strcmp(argv[i], "-functions") == 0) {
- qPrintTestSlots();
- exit(0);
+ if (qml) {
+ QTest::printAvailableFunctions = true;
+ } else {
+ qPrintTestSlots();
+ exit(0);
+ }
} else if(strcmp(argv[i], "-xunitxml") == 0){
QTestLog::setLogMode(QTestLog::XunitXML);
} else if (strcmp(argv[i], "-xml") == 0) {
@@ -1221,6 +1229,32 @@ static void qParseArgs(int argc, char *argv[])
} else if (argv[i][0] == '-') {
printf("Unknown option: '%s'\n\n%s", argv[i], testOptions);
exit(1);
+ } else if (qml) {
+ // We can't check the availability of test functions until
+ // we load the QML files. So just store the data for now.
+ int colon = -1;
+ int offset;
+ for(offset = 0; *(argv[i]+offset); ++offset) {
+ if (*(argv[i]+offset) == ':') {
+ if (*(argv[i]+offset+1) == ':') {
+ // "::" is used as a test name separator.
+ // e.g. "ClickTests::test_click:row1".
+ ++offset;
+ } else {
+ colon = offset;
+ break;
+ }
+ }
+ }
+ if (colon == -1) {
+ QTest::testFunctions += QString::fromLatin1(argv[i]);
+ QTest::testTags += QString();
+ } else {
+ QTest::testFunctions +=
+ QString::fromLatin1(argv[i], colon);
+ QTest::testTags +=
+ QString::fromLatin1(argv[i] + colon + 1);
+ }
} else {
if (!QTest::testFuncs) {
QTest::testFuncs = new QTest::TestFunction[512];
@@ -1785,7 +1819,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
QTEST_ASSERT(metaObject);
QTestResult::setCurrentTestObject(metaObject->className());
- qParseArgs(argc, argv);
+ qtest_qParseArgs(argc, argv, false);
if (QTest::randomOrder) {
seedRandom();
}
diff --git a/src/testlib/qtestlog_p.h b/src/testlib/qtestlog_p.h
index 59282fd..a892d3d 100644
--- a/src/testlib/qtestlog_p.h
+++ b/src/testlib/qtestlog_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
class QBenchmarkResult;
-class QTestLog
+class Q_TESTLIB_EXPORT QTestLog
{
public:
enum LogMode { Plain = 0, XML, LightXML, XunitXML };
diff --git a/src/testlib/qtestresult_p.h b/src/testlib/qtestresult_p.h
index 15523f5..7ff120a 100644
--- a/src/testlib/qtestresult_p.h
+++ b/src/testlib/qtestresult_p.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
class QTestResultPrivate;
class QTestData;
-class QTestResult
+class Q_TESTLIB_EXPORT QTestResult
{
public:
enum TestLocation { NoWhere = 0, DataFunc = 1, InitFunc = 2, Func = 3, CleanupFunc = 4 };
diff --git a/src/testlib/qtesttable_p.h b/src/testlib/qtesttable_p.h
index d085b57..f835506 100644
--- a/src/testlib/qtesttable_p.h
+++ b/src/testlib/qtesttable_p.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
class QTestData;
class QTestTablePrivate;
-class QTestTable
+class Q_TESTLIB_EXPORT QTestTable
{
public:
QTestTable();