From dff18b8e80609da91bf9e9134967dcf0d23eca9e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 9 Jan 2015 14:52:02 +0100 Subject: 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 --- .../auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp') 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(QTest::currentAppName()) }; @@ -150,7 +150,6 @@ void tst_QCoreApplication::argc() QCOMPARE(app.arguments().count(), 1); } } -#endif class EventGenerator : public QObject { -- cgit v1.2.3