summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-01-09 14:52:02 +0100
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-02-05 05:20:20 +0000
commitdff18b8e80609da91bf9e9134967dcf0d23eca9e (patch)
tree222a4d4d373f178d616a960bffbc2837047831dc /tests
parent57469a8e10f11ee04964ed9f8f8d00de0d6d45c1 (diff)
Windows: Allow for passing a modified argv to QCoreApplication.
Check by comparing __argc/__argv whether a modified argv was passed to QCoreApplication. If that is the case, build QCoreApplication::arguments() from that argv instead of using the command line. [ChangeLog][Important Behavior Changes][QCoreApplication] On Windows, QCoreApplication::arguments() now returns a list built from argv on Windows as well if a modified argv was passed to the class' constructor. Task-number: QTBUG-30330 Task-number: QTSOLBUG-184 Change-Id: I2498bb554130e7bfaeada3aebe786dfdd0eb534d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp7
-rw-r--r--tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h2
2 files changed, 3 insertions, 6 deletions
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
index 442d9db85c..6ffe2bc6fe 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
+++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp
@@ -109,11 +109,11 @@ void tst_QCoreApplication::qAppName()
QCOMPARE(QCoreApplication::applicationName(), QString::fromLatin1(appName));
}
-// "QCoreApplication::arguments() always parses arguments from actual command line on Windows
-// making this test invalid."
-#ifndef Q_OS_WIN
void tst_QCoreApplication::argc()
{
+#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
+ QSKIP("QCoreApplication::arguments() parses arguments from actual command line on this platform.");
+#endif
{
int argc = 1;
char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
@@ -150,7 +150,6 @@ void tst_QCoreApplication::argc()
QCOMPARE(app.arguments().count(), 1);
}
}
-#endif
class EventGenerator : public QObject
{
diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h
index 6f09399654..33b7084809 100644
--- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h
+++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.h
@@ -43,9 +43,7 @@ private slots:
void sendEventsOnProcessEvents(); // this must be the first test
void getSetCheck();
void qAppName();
-#ifndef Q_OS_WIN
void argc();
-#endif
void postEvent();
void removePostedEvents();
#ifndef QT_NO_THREAD