From 1e589e37a991b29076e9a661f92dfa178421c208 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 24 Jun 2015 10:15:16 +0200 Subject: Unify translated error messages * Enclose file paths in "" * Localize file paths with QDir::toNativeSeparators. * Make sure sentences end with a '.' * Append error details always by ':', e.g. tr("Failed to copy file '%1': %2").(...) * Use 'directory' instead of 'folder' everywhere Change-Id: Ie045f429f72ad5045c96537465c5fb9d2e99d250 Reviewed-by: Karsten Heimrich --- tests/auto/installer/clientserver/tst_clientserver.cpp | 4 ++-- .../copyoperationtest/tst_copyoperationtest.cpp | 16 ++++++++-------- .../tst_fakestopprocessforupdateoperation.cpp | 2 +- tests/auto/installer/lib7zfacade/tst_lib7zfacade.cpp | 2 +- .../messageboxhandler/tst_messageboxhandler.cpp | 2 +- .../mkdiroperationtest/tst_mkdiroperationtest.cpp | 2 +- tests/auto/installer/settings/tst_settings.cpp | 2 +- .../settingsoperation/tst_settingsoperation.cpp | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/installer/clientserver/tst_clientserver.cpp b/tests/auto/installer/clientserver/tst_clientserver.cpp index 450c9ee8c..0acc19b4c 100644 --- a/tests/auto/installer/clientserver/tst_clientserver.cpp +++ b/tests/auto/installer/clientserver/tst_clientserver.cpp @@ -213,7 +213,7 @@ private slots: QLocalSocket socket; socket.connectToServer(socketName); - QVERIFY2(socket.waitForConnected(), "Could not connect to server."); + QVERIFY2(socket.waitForConnected(), "Cannot connect to server."); QCOMPARE(socket.state() == QLocalSocket::ConnectedState, true); sendCommand(&socket, Protocol::Authorize, QString(Protocol::DefaultAuthorizationKey)); @@ -246,7 +246,7 @@ private slots: QLocalSocket socket; socket.connectToServer(socketName); - QVERIFY2(socket.waitForConnected(), "Could not connect to server."); + QVERIFY2(socket.waitForConnected(), "Cannot connect to server."); QCOMPARE(socket.state() == QLocalSocket::ConnectedState, true); sendCommand(&socket, Protocol::Authorize, QString::fromLatin1("SomeKey")); diff --git a/tests/auto/installer/copyoperationtest/tst_copyoperationtest.cpp b/tests/auto/installer/copyoperationtest/tst_copyoperationtest.cpp index da26daf2c..6cc564742 100644 --- a/tests/auto/installer/copyoperationtest/tst_copyoperationtest.cpp +++ b/tests/auto/installer/copyoperationtest/tst_copyoperationtest.cpp @@ -89,17 +89,17 @@ private slots: QFETCH(QString, source); QFETCH(QString, destination); - QVERIFY2(QFileInfo(source).exists(), QString("Source '%1' does not exist.").arg(source).toLatin1()); + QVERIFY2(QFileInfo(source).exists(), QString("Source file \"%1\" does not exist.").arg(source).toLatin1()); CopyOperation op; op.setArguments(QStringList() << source << destination); op.backup(); QVERIFY2(op.performOperation(), op.errorString().toLatin1()); - QVERIFY2(QFileInfo(m_testDestinationFilePath).exists(), QString("Copying from '%1' to '%2' was " + QVERIFY2(QFileInfo(m_testDestinationFilePath).exists(), QString("Copying from \"%1\" to \"%2\" was " "not working: '%3' does not exist").arg(source, destination, m_testDestinationFilePath).toLatin1()); QVERIFY2(op.undoOperation(), op.errorString().toLatin1()); - QVERIFY2(!QFileInfo(m_testDestinationFilePath).exists(), QString("Undo of copying from '%1' to " - "'%2' was not working.").toLatin1()); + QVERIFY2(!QFileInfo(m_testDestinationFilePath).exists(), QString("Undo of copying from \"%1\" to " + "\"%2\" was not working.").toLatin1()); } void testCopyIfDestinationExist_data() @@ -121,7 +121,7 @@ private slots: QByteArray testFileHash = QInstaller::calculateHash(m_testDestinationFilePath, QCryptographicHash::Sha1); - QVERIFY2(QFileInfo(source).exists(), QString("Source '%1' does not exist.").arg(source).toLatin1()); + QVERIFY2(QFileInfo(source).exists(), QString("Source file \"%1\" does not exist.").arg(source).toLatin1()); CopyOperation op; op.setArguments(QStringList() << source << destination); op.backup(); @@ -132,8 +132,8 @@ private slots: QByteArray currentFileHash = QInstaller::calculateHash(m_testDestinationFilePath, QCryptographicHash::Sha1); QVERIFY(testFileHash != currentFileHash); - QVERIFY2(QFileInfo(m_testDestinationFilePath).exists(), QString("Copying from '%1' to '%2' was " - "not working: '%3' does not exist").arg(source, destination, m_testDestinationFilePath).toLatin1()); + QVERIFY2(QFileInfo(m_testDestinationFilePath).exists(), QString("Copying from \"%1\" to \"%2\" was " + "not working: \"%3\" does not exist").arg(source, destination, m_testDestinationFilePath).toLatin1()); // undo should replace the new one with the old backuped one QVERIFY2(op.undoOperation(), op.errorString().toLatin1()); @@ -142,7 +142,7 @@ private slots: } void init() { - QVERIFY2(!QFileInfo(m_testDestinationFilePath).exists(), QString("Destination '%1' should not exist " + QVERIFY2(!QFileInfo(m_testDestinationFilePath).exists(), QString("Destination \"%1\" should not exist " "to test the copy operation.").arg(m_testDestinationFilePath).toLatin1()); QDir().mkpath(m_testDestinationPath); } diff --git a/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp b/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp index 58624d24b..5feb64c93 100644 --- a/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp +++ b/tests/auto/installer/fakestopprocessforupdateoperation/tst_fakestopprocessforupdateoperation.cpp @@ -37,7 +37,7 @@ private slots: QVERIFY(!op.undoOperation()); QCOMPARE(UpdateOperation::Error(op.error()), UpdateOperation::UserDefinedError); - QCOMPARE(op.errorString(), QString("Could not get package manager core.")); + QCOMPARE(op.errorString(), QString("Cannot get package manager core.")); } void testRunningApplication() diff --git a/tests/auto/installer/lib7zfacade/tst_lib7zfacade.cpp b/tests/auto/installer/lib7zfacade/tst_lib7zfacade.cpp index 5cd9f32d3..654320537 100644 --- a/tests/auto/installer/lib7zfacade/tst_lib7zfacade.cpp +++ b/tests/auto/installer/lib7zfacade/tst_lib7zfacade.cpp @@ -100,7 +100,7 @@ private slots: QVERIFY(file.open(QIODevice::ReadOnly)); QVector files = Lib7z::listArchive(&file); } catch (const Lib7z::SevenZipException& e) { - QCOMPARE(e.message(), QString("Could not open archive ':///data/invalid.7z'.")); + QCOMPARE(e.message(), QString("Cannot open archive ':///data/invalid.7z'.")); } catch (...) { QFAIL("Unexpected error during list archive."); } diff --git a/tests/auto/installer/messageboxhandler/tst_messageboxhandler.cpp b/tests/auto/installer/messageboxhandler/tst_messageboxhandler.cpp index 75df29949..aeb75f7b1 100644 --- a/tests/auto/installer/messageboxhandler/tst_messageboxhandler.cpp +++ b/tests/auto/installer/messageboxhandler/tst_messageboxhandler.cpp @@ -94,7 +94,7 @@ private slots: wantedButton = button; } - QVERIFY2(wantedButton != QMessageBox::NoButton, "Could not find a wantedButton."); + QVERIFY2(wantedButton != QMessageBox::NoButton, "Cannot find a wantedButton."); QCOMPARE(static_cast(returnButton), wantedButton); } while (standardButtons < m_maxStandardButtons); } diff --git a/tests/auto/installer/mkdiroperationtest/tst_mkdiroperationtest.cpp b/tests/auto/installer/mkdiroperationtest/tst_mkdiroperationtest.cpp index f7922e62d..875e5107b 100644 --- a/tests/auto/installer/mkdiroperationtest/tst_mkdiroperationtest.cpp +++ b/tests/auto/installer/mkdiroperationtest/tst_mkdiroperationtest.cpp @@ -123,7 +123,7 @@ private slots: file.close(); QVERIFY2(!op.undoOperation(), op.errorString().toLatin1()); QVERIFY2(file.exists(), filepath.toLatin1()); - QVERIFY2(QDir(filepath).remove(filepath), "Could not remove file"); + QVERIFY2(QDir(filepath).remove(filepath), "Cannot remove file"); QVERIFY2(!file.exists(), filepath.toLatin1()); QVERIFY2(op.undoOperation(), op.errorString().toLatin1()); QVERIFY2(!QDir(path).exists(), path.toLatin1()); diff --git a/tests/auto/installer/settings/tst_settings.cpp b/tests/auto/installer/settings/tst_settings.cpp index 47322984f..dca8838c5 100644 --- a/tests/auto/installer/settings/tst_settings.cpp +++ b/tests/auto/installer/settings/tst_settings.cpp @@ -110,7 +110,7 @@ void tst_Settings::loadNotExistingConfig() try { Settings::fromFileAndPrefix(":/data/inexisting_config.xml", ":/data"); } catch (const Error &error) { - QCOMPARE(error.message(), QLatin1String("Could not open settings file " + QCOMPARE(error.message(), QLatin1String("Cannot open settings file " ":/data/inexisting_config.xml for reading: " "Unknown error")); return; diff --git a/tests/auto/installer/settingsoperation/tst_settingsoperation.cpp b/tests/auto/installer/settingsoperation/tst_settingsoperation.cpp index 1b434ecb3..319d2123d 100644 --- a/tests/auto/installer/settingsoperation/tst_settingsoperation.cpp +++ b/tests/auto/installer/settingsoperation/tst_settingsoperation.cpp @@ -122,7 +122,7 @@ private slots: QVERIFY2(settingsOperation.performOperation(), settingsOperation.errorString().toLatin1()); - QVERIFY2(compareFiles(verifyFilePath, testFilePath), QString("'%1' and '%2' are different") + QVERIFY2(compareFiles(verifyFilePath, testFilePath), QString("\"%1\" and \"%2\" are different.") .arg(verifyFilePath, testFilePath).toLatin1()); } -- cgit v1.2.3