summaryrefslogtreecommitdiffstats
path: root/tests/auto/qcoreapplication
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@edeltech.ch>2013-11-03 23:00:18 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-04 11:14:21 +0100
commit6bf8bbeb813f70b44105994d745133d9ed5f9ea1 (patch)
tree6c862877d857241de5017f7bd91565aaeb225601 /tests/auto/qcoreapplication
parentbe4e275fdb2f144b79c90b7fe612132ab3dbc0a9 (diff)
Expose QTest::currentAppName() and remove hard-coded argv[0] in tests
Except where we're actually testing QCoreApplication::applicationName() and friends. Based on a3530859e9a7423db0b6839f15538f248aaf4a79 Change-Id: I36ef8cbb5d8bce45225a7f81409f46f1d584287b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Diffstat (limited to 'tests/auto/qcoreapplication')
-rw-r--r--tests/auto/qcoreapplication/tst_qcoreapplication.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/auto/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/qcoreapplication/tst_qcoreapplication.cpp
index 9eb53ee9cc..74605f7384 100644
--- a/tests/auto/qcoreapplication/tst_qcoreapplication.cpp
+++ b/tests/auto/qcoreapplication/tst_qcoreapplication.cpp
@@ -80,7 +80,7 @@ public:
void tst_QCoreApplication::sendEventsOnProcessEvents()
{
int argc = 1;
- char *argv[] = { "tst_qcoreapplication" };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
EventSpy spy;
@@ -102,7 +102,7 @@ void tst_QCoreApplication::getSetCheck()
// Test the property
{
int argc = 1;
- char *argv[] = { "tst_qcoreapplication" };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
QCOMPARE(app.property("applicationVersion").toString(), v);
}
@@ -114,7 +114,7 @@ void tst_QCoreApplication::getSetCheck()
void tst_QCoreApplication::qAppName()
{
int argc = 1;
- char *argv[] = { "tst_qcoreapplication" };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
QVERIFY(!::qAppName().isEmpty());
}
@@ -123,7 +123,7 @@ void tst_QCoreApplication::argc()
{
{
int argc = 1;
- char *argv[] = { "tst_qcoreapplication" };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
QCOMPARE(argc, 1);
QCOMPARE(app.argc(), 1);
@@ -131,7 +131,7 @@ void tst_QCoreApplication::argc()
{
int argc = 4;
- char *argv[] = { "tst_qcoreapplication", "arg1", "arg2", "arg3" };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()), "arg1", "arg2", "arg3" };
QCoreApplication app(argc, argv);
QCOMPARE(argc, 4);
QCOMPARE(app.argc(), 4);
@@ -147,7 +147,7 @@ void tst_QCoreApplication::argc()
{
int argc = 2;
- char *argv[] = { "tst_qcoreapplication", "-qmljsdebugger=port:3768,block" };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()), "-qmljsdebugger=port:3768,block" };
QCoreApplication app(argc, argv);
QCOMPARE(argc, 1);
QCOMPARE(app.argc(), 1);
@@ -179,7 +179,7 @@ public:
void tst_QCoreApplication::postEvent()
{
int argc = 1;
- char *argv[] = { "tst_qcoreapplication" };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
EventSpy spy;
@@ -264,7 +264,7 @@ void tst_QCoreApplication::postEvent()
void tst_QCoreApplication::removePostedEvents()
{
int argc = 1;
- char *argv[] = { "tst_qcoreapplication" };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
EventSpy spy;
@@ -431,7 +431,7 @@ public:
void tst_QCoreApplication::deliverInDefinedOrder()
{
int argc = 1;
- char *argv[] = { "tst_qcoreapplication" };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
DeliverInDefinedOrderObject obj(&app);
@@ -474,7 +474,7 @@ public:
void tst_QCoreApplication::globalPostedEventsCount()
{
int argc = 1;
- char *argv[] = { "tst_qcoreapplication" };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
QCoreApplication::sendPostedEvents();
@@ -520,7 +520,7 @@ public:
void tst_QCoreApplication::processEventsAlwaysSendsPostedEvents()
{
int argc = 1;
- char *argv[] = { "tst_qcoreapplication" };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
ProcessEventsAlwaysSendsPostedEventsObject object;
@@ -538,7 +538,7 @@ void tst_QCoreApplication::processEventsAlwaysSendsPostedEvents()
void tst_QCoreApplication::reexec()
{
int argc = 1;
- char *argv[] = { "tst_qcoreapplication" };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
// exec once
@@ -553,7 +553,7 @@ void tst_QCoreApplication::reexec()
void tst_QCoreApplication::execAfterExit()
{
int argc = 1;
- char *argv[] = { "tst_qcoreapplication" };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
app.exit(1);
@@ -564,7 +564,7 @@ void tst_QCoreApplication::execAfterExit()
void tst_QCoreApplication::eventLoopExecAfterExit()
{
int argc = 1;
- char *argv[] = { "tst_qcoreapplication" };
+ char *argv[] = { const_cast<char*>(QTest::currentAppName()) };
QCoreApplication app(argc, argv);
// exec once and exit