diff --git a/src/autotests/DBusTest.cpp b/src/autotests/DBusTest.cpp index 5ae2f54b..ff44ebac 100644 --- a/src/autotests/DBusTest.cpp +++ b/src/autotests/DBusTest.cpp @@ -27,7 +27,7 @@ using namespace Konsole; /* Exec a new Konsole and grab its dbus */ void DBusTest::initTestCase() { - const QString interfaceName = "org.kde.konsole"; + const QString interfaceName = QStringLiteral("org.kde.konsole"); QDBusConnectionInterface* bus = 0; QStringList konsoleServices; @@ -48,7 +48,7 @@ void DBusTest::initTestCase() } // Create a new Konsole with a separate process id - int result = KProcess::execute("konsole"); + int result = KProcess::execute(QStringLiteral("konsole")); if (result) QFAIL(QString("Unable to exec a new Konsole: %1").arg(result).toLatin1().data()); @@ -93,7 +93,7 @@ void DBusTest::cleanupTestCase() QStringLiteral("org.qtproject.Qt.QWidget")); QVERIFY2(iface.isValid(), "Unable to get a dbus interface to Konsole!"); - QDBusReply instanceReply = iface.call("close"); + QDBusReply instanceReply = iface.call(QStringLiteral("close")); if (!instanceReply.isValid()) QFAIL(QString("Unable to close Konsole: %1").arg(instanceReply.error().message()).toLatin1().data()); } @@ -112,47 +112,47 @@ void DBusTest::testSessions() QVERIFY(iface.isValid()); //****************** Test is/set MonitorActivity - voidReply = iface.call("setMonitorActivity", false); + voidReply = iface.call(QStringLiteral("setMonitorActivity"), false); QVERIFY(voidReply.isValid()); - boolReply = iface.call("isMonitorActivity"); + boolReply = iface.call(QStringLiteral("isMonitorActivity")); QVERIFY(boolReply.isValid()); QCOMPARE(boolReply.value(), false); - voidReply = iface.call("setMonitorActivity", true); + voidReply = iface.call(QStringLiteral("setMonitorActivity"), true); QVERIFY(voidReply.isValid()); - boolReply = iface.call("isMonitorActivity"); + boolReply = iface.call(QStringLiteral("isMonitorActivity")); QVERIFY(boolReply.isValid()); QCOMPARE(boolReply.value(), true); //****************** Test is/set MonitorSilence - voidReply = iface.call("setMonitorSilence", false); + voidReply = iface.call(QStringLiteral("setMonitorSilence"), false); QVERIFY(voidReply.isValid()); - boolReply = iface.call("isMonitorSilence"); + boolReply = iface.call(QStringLiteral("isMonitorSilence")); QVERIFY(boolReply.isValid()); QCOMPARE(boolReply.value(), false); - voidReply = iface.call("setMonitorSilence", true); + voidReply = iface.call(QStringLiteral("setMonitorSilence"), true); QVERIFY(voidReply.isValid()); - boolReply = iface.call("isMonitorSilence"); + boolReply = iface.call(QStringLiteral("isMonitorSilence")); QVERIFY(boolReply.isValid()); QCOMPARE(boolReply.value(), true); //****************** Test codec and setCodec - arrayReply = iface.call("codec"); + arrayReply = iface.call(QStringLiteral("codec")); QVERIFY(arrayReply.isValid()); // Obtain a list of system's Codecs QList availableCodecs = QTextCodec::availableCodecs(); for (int i = 0; i < availableCodecs.count(); ++i) { - boolReply = iface.call("setCodec", availableCodecs[i]); + boolReply = iface.call(QStringLiteral("setCodec"), availableCodecs[i]); QVERIFY(boolReply.isValid()); QCOMPARE(boolReply.value(), true); - arrayReply = iface.call("codec"); + arrayReply = iface.call(QStringLiteral("codec")); QVERIFY(arrayReply.isValid()); // Compare result with name due to aliases issue // Better way to do this? @@ -161,45 +161,45 @@ void DBusTest::testSessions() } //****************** Test is/set flowControlEnabled - voidReply = iface.call("setFlowControlEnabled", true); + voidReply = iface.call(QStringLiteral("setFlowControlEnabled"), true); QVERIFY(voidReply.isValid()); - boolReply = iface.call("flowControlEnabled"); + boolReply = iface.call(QStringLiteral("flowControlEnabled")); QVERIFY(boolReply.isValid()); QCOMPARE(boolReply.value(), true); - voidReply = iface.call("setFlowControlEnabled", false); + voidReply = iface.call(QStringLiteral("setFlowControlEnabled"), false); QVERIFY(voidReply.isValid()); - boolReply = iface.call("flowControlEnabled"); + boolReply = iface.call(QStringLiteral("flowControlEnabled")); QVERIFY(boolReply.isValid()); QCOMPARE(boolReply.value(), false); //****************** Test is/set environment - listReply = iface.call("environment"); + listReply = iface.call(QStringLiteral("environment")); QVERIFY(listReply.isValid()); QStringList prevEnv = listReply.value(); //for (int i = 0; i < prevEnv.size(); ++i) // qDebug()<< prevEnv.at(i).toLocal8Bit().constData() << endl; - voidReply = iface.call("setEnvironment", QStringList()); + voidReply = iface.call(QStringLiteral("setEnvironment"), QStringList()); QVERIFY(voidReply.isValid()); - listReply = iface.call("environment"); + listReply = iface.call(QStringLiteral("environment")); QVERIFY(listReply.isValid()); QCOMPARE(listReply.value(), QStringList()); - voidReply = iface.call("setEnvironment", prevEnv); + voidReply = iface.call(QStringLiteral("setEnvironment"), prevEnv); QVERIFY(voidReply.isValid()); - listReply = iface.call("environment"); + listReply = iface.call(QStringLiteral("environment")); QVERIFY(listReply.isValid()); QCOMPARE(listReply.value(), prevEnv); //****************** Test is/set title // TODO: Consider checking what is in Profile - stringReply = iface.call("title", Session::LocalTabTitle); + stringReply = iface.call(QStringLiteral("title"), Session::LocalTabTitle); QVERIFY(stringReply.isValid()); //qDebug()<< stringReply.value(); @@ -207,7 +207,7 @@ void DBusTest::testSessions() // set title to, what title should be QMap titleMap; - titleMap["Shell"] = "Shell"; + titleMap[QStringLiteral("Shell")] = QLatin1String("Shell"); // BUG: It appears that Session::LocalTabTitle is set to Shell and // doesn't change. While RemoteTabTitle is actually the LocalTabTitle @@ -215,10 +215,10 @@ void DBusTest::testSessions() QMapIterator i(titleMap); while (i.hasNext()) { i.next(); - voidReply = iface.call("setTitle", Session::LocalTabTitle, i.key()); + voidReply = iface.call(QStringLiteral("setTitle"), Session::LocalTabTitle, i.key()); QVERIFY(voidReply.isValid()); - stringReply = iface.call("title", Session::LocalTabTitle); + stringReply = iface.call(QStringLiteral("title"), Session::LocalTabTitle); QVERIFY(stringReply.isValid()); QCOMPARE(stringReply.value(), i.value()); diff --git a/src/autotests/HistoryTest.cpp b/src/autotests/HistoryTest.cpp index a2823d14..1ae0cea5 100644 --- a/src/autotests/HistoryTest.cpp +++ b/src/autotests/HistoryTest.cpp @@ -111,7 +111,7 @@ void HistoryTest::testHistoryScroll() QCOMPARE(historyTypeNone.maximumLineCount(), 0); // File - historyScroll = new HistoryScrollFile(QString("test.log")); + historyScroll = new HistoryScrollFile(QStringLiteral("test.log")); QVERIFY(historyScroll->hasScroll()); QCOMPARE(historyScroll->getLines(), 0); QCOMPARE(historyScroll->getLineLen(0), 0); diff --git a/src/autotests/PartTest.cpp b/src/autotests/PartTest.cpp index 73cddbb1..b3e7797b 100644 --- a/src/autotests/PartTest.cpp +++ b/src/autotests/PartTest.cpp @@ -46,7 +46,7 @@ void PartTest::testFd() QStringList pingList; QFileInfo info; QString pingExe; - pingList << "/bin/ping" << "/sbin/ping"; + pingList << QStringLiteral("/bin/ping") << QStringLiteral("/sbin/ping"); for (int i = 0; i < pingList.size(); ++i) { info.setFile(pingList.at(i)); if (info.exists() && info.isExecutable()) @@ -67,7 +67,7 @@ void PartTest::testFd() // start a pty process KPtyProcess ptyProcess; - ptyProcess.setProgram(pingExe, QStringList() << "localhost"); + ptyProcess.setProgram(pingExe, QStringList() << QStringLiteral("localhost")); ptyProcess.setPtyChannels(KPtyProcess::AllChannels); ptyProcess.start(); QVERIFY(ptyProcess.waitForStarted()); @@ -85,7 +85,7 @@ void PartTest::testFd() QWeakPointer dialog = new QDialog(); QVBoxLayout* layout = new QVBoxLayout(dialog.data()); - layout->addWidget(new QLabel("Output of 'ping localhost' should appear in a terminal below for 5 seconds")); + layout->addWidget(new QLabel(QStringLiteral("Output of 'ping localhost' should appear in a terminal below for 5 seconds"))); layout->addWidget(terminalPart->widget()); QTimer::singleShot(5000, dialog.data(), SLOT(close())); dialog.data()->exec(); @@ -98,7 +98,7 @@ void PartTest::testFd() KParts::Part* PartTest::createPart() { - KService::Ptr service = KService::serviceByDesktopName("konsolepart"); + KService::Ptr service = KService::serviceByDesktopName(QStringLiteral("konsolepart")); if (!service) // not found return 0; KPluginFactory* factory = KPluginLoader(service->library()).factory(); diff --git a/src/autotests/PtyTest.cpp b/src/autotests/PtyTest.cpp index 8df7065f..e3934723 100644 --- a/src/autotests/PtyTest.cpp +++ b/src/autotests/PtyTest.cpp @@ -76,7 +76,7 @@ void PtyTest::testWindowSize() void PtyTest::testRunProgram() { Pty pty; - QString program = "sh"; + QString program = QStringLiteral("sh"); QStringList arguments ; arguments << program; QStringList environments; diff --git a/src/autotests/SessionTest.cpp b/src/autotests/SessionTest.cpp index 76d1d390..c0c631b4 100644 --- a/src/autotests/SessionTest.cpp +++ b/src/autotests/SessionTest.cpp @@ -37,10 +37,10 @@ void SessionTest::testNoProfile() QCOMPARE(session->isRunning(), false); QCOMPARE(session->sessionId(), 1); QCOMPARE(session->isRemote(), false); - QCOMPARE(session->program(), QString("")); + QCOMPARE(session->program(), QString()); QCOMPARE(session->arguments(), QStringList()); - QCOMPARE(session->tabTitleFormat(Session::LocalTabTitle), QString("")); - QCOMPARE(session->tabTitleFormat(Session::RemoteTabTitle), QString("")); + QCOMPARE(session->tabTitleFormat(Session::LocalTabTitle), QString()); + QCOMPARE(session->tabTitleFormat(Session::RemoteTabTitle), QString()); delete session; } diff --git a/src/autotests/ShellCommandTest.cpp b/src/autotests/ShellCommandTest.cpp index 377e7651..0df4e498 100644 --- a/src/autotests/ShellCommandTest.cpp +++ b/src/autotests/ShellCommandTest.cpp @@ -39,7 +39,7 @@ void ShellCommandTest::cleanup() void ShellCommandTest::testConstructorWithOneArguemnt() { - const QString fullCommand("sudo apt-get update"); + const QString fullCommand(QStringLiteral("sudo apt-get update")); ShellCommand shellCommand(fullCommand); QCOMPARE(shellCommand.command(), QString("sudo")); QCOMPARE(shellCommand.fullCommand(), fullCommand); @@ -48,9 +48,9 @@ void ShellCommandTest::testConstructorWithOneArguemnt() void ShellCommandTest::testConstructorWithTwoArguments() { - const QString command("wc"); + const QString command(QStringLiteral("wc")); QStringList arguments; - arguments << "wc" << "-l" << "*.cpp" ; + arguments << QStringLiteral("wc") << QStringLiteral("-l") << QStringLiteral("*.cpp") ; ShellCommand shellCommand(command, arguments); QCOMPARE(shellCommand.command(), command); @@ -60,16 +60,16 @@ void ShellCommandTest::testConstructorWithTwoArguments() void ShellCommandTest::testExpandEnvironmentVariable() { - QString text = "PATH=$PATH:~/bin"; - const QString env = "PATH"; - const QString value = "/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin"; + QString text = QStringLiteral("PATH=$PATH:~/bin"); + const QString env = QStringLiteral("PATH"); + const QString value = QStringLiteral("/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin"); qputenv(env.toLocal8Bit().constData(), value.toLocal8Bit()); const QString result = ShellCommand::expand(text); const QString expected = text.replace('$' + env, value); QCOMPARE(result, expected); - text = "PATH=$PATH:\\$ESCAPED:~/bin"; + text = QLatin1String("PATH=$PATH:\\$ESCAPED:~/bin"); qputenv(env.toLocal8Bit().constData(), value.toLocal8Bit()); const QString result2 = ShellCommand::expand(text); const QString expected2 = text.replace('$' + env, value); @@ -92,10 +92,10 @@ void ShellCommandTest::testValidLeadingEnvCharacter() void ShellCommandTest::testArgumentsWithSpaces() { - const QString command("dir"); + const QString command(QStringLiteral("dir")); QStringList arguments; - arguments << "dir" << "c:\\Program Files" << "System" << "*.ini" ; - const QString expected_arg("dir \"c:\\Program Files\" System *.ini"); + arguments << QStringLiteral("dir") << QStringLiteral("c:\\Program Files") << QStringLiteral("System") << QStringLiteral("*.ini") ; + const QString expected_arg(QStringLiteral("dir \"c:\\Program Files\" System *.ini")); ShellCommand shellCommand(command, arguments); QCOMPARE(shellCommand.command(), command); @@ -105,7 +105,7 @@ void ShellCommandTest::testArgumentsWithSpaces() void ShellCommandTest::testEmptyCommand() { - const QString command(""); + const QString command = QString(); ShellCommand shellCommand(command); QCOMPARE(shellCommand.command(), QString()); QCOMPARE(shellCommand.arguments(), QStringList()); diff --git a/src/autotests/TerminalInterfaceTest.cpp b/src/autotests/TerminalInterfaceTest.cpp index e5f0061e..896db5fb 100644 --- a/src/autotests/TerminalInterfaceTest.cpp +++ b/src/autotests/TerminalInterfaceTest.cpp @@ -63,9 +63,9 @@ void TerminalInterfaceTest::testTerminalInterfaceNoShell() int foregroundProcessId = terminal->foregroundProcessId(); QCOMPARE(foregroundProcessId, -1); QString foregroundProcessName = terminal->foregroundProcessName(); - QCOMPARE(foregroundProcessName, QString("")); + QCOMPARE(foregroundProcessName, QString()); const QString currentWorkingDirectory = terminal->currentWorkingDirectory(); - QCOMPARE(currentWorkingDirectory, QString("")); + QCOMPARE(currentWorkingDirectory, QString()); delete _terminalPart; } @@ -90,7 +90,7 @@ void TerminalInterfaceTest::testTerminalInterface() int foregroundProcessId = terminal->foregroundProcessId(); QCOMPARE(foregroundProcessId, -1); QString foregroundProcessName = terminal->foregroundProcessName(); - QCOMPARE(foregroundProcessName, QString("")); + QCOMPARE(foregroundProcessName, QString()); // terminalProcessId() is the user's default shell // FIXME: find a way to verify this @@ -114,7 +114,7 @@ void TerminalInterfaceTest::testTerminalInterface() // Let's trigger some signals // #1A - Test signal currentDirectoryChanged(QString) - currentDirectory = QString("/tmp"); + currentDirectory = QStringLiteral("/tmp"); terminal->sendInput("cd " + currentDirectory + '\n'); sleep(2000); QCOMPARE(stateSpy.count(), 1); @@ -130,7 +130,7 @@ void TerminalInterfaceTest::testTerminalInterface() // #1B - Test signal currentDirectoryChanged(QString) // Invalid directory - no signal should be emitted - terminal->sendInput("cd /usrADADFASDF\n"); + terminal->sendInput(QStringLiteral("cd /usrADADFASDF\n")); sleep(2000); QCOMPARE(stateSpy.count(), 0); @@ -139,7 +139,7 @@ void TerminalInterfaceTest::testTerminalInterface() QCOMPARE(currentWorkingDirectory2, currentDirectory); // Test starting a new program - QString command = "top"; + QString command = QStringLiteral("top"); terminal->sendInput(command + '\n'); sleep(2000); // FIXME: find a good way to validate process id of 'top' @@ -148,14 +148,14 @@ void TerminalInterfaceTest::testTerminalInterface() foregroundProcessName = terminal->foregroundProcessName(); QCOMPARE(foregroundProcessName, command); - terminal->sendInput("q"); + terminal->sendInput(QStringLiteral("q")); sleep(2000); // Nothing running in foreground foregroundProcessId = terminal->foregroundProcessId(); QCOMPARE(foregroundProcessId, -1); foregroundProcessName = terminal->foregroundProcessName(); - QCOMPARE(foregroundProcessName, QString("")); + QCOMPARE(foregroundProcessName, QString()); // Test destroyed() QSignalSpy destroyedSpy(_terminalPart, SIGNAL(destroyed())); @@ -178,7 +178,7 @@ void TerminalInterfaceTest::sleep(int msecs) KParts::Part* TerminalInterfaceTest::createPart() { - KService::Ptr service = KService::serviceByDesktopName("konsolepart"); + KService::Ptr service = KService::serviceByDesktopName(QStringLiteral("konsolepart")); if (!service) // not found return 0; KPluginFactory* factory = KPluginLoader(service->library()).factory();