summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-09-16 17:50:41 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-09-17 22:23:37 +0200
commit18cda2f669acd303f540cda12cc9bb655a7f1282 (patch)
treef08a43aada4ba1361d72ba5899b4f4c5a88f68a4 /tests/auto
parent8be31ab2e15a20de586bd31f7786b5c3f34b7e4b (diff)
Fix warning about discarded return value in QTranslator test
Use QVERIFY in test functions, and (void)tr.load outside. Change-Id: I18d2eb3aeaf00f9f2bbe75d0a2d8b12569b541e1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp
index cc35b6cb59..d34fb3e8dc 100644
--- a/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp
+++ b/tests/auto/corelib/kernel/qtranslator/tst_qtranslator.cpp
@@ -159,7 +159,7 @@ class TranslatorThread : public QThread
{
void run() override {
QTranslator tor( 0 );
- tor.load("hellotr_la");
+ (void)tor.load("hellotr_la");
if (tor.isEmpty())
qFatal("Could not load translation");
@@ -181,17 +181,17 @@ void tst_QTranslator::testLanguageChange()
languageChangeEventCounter = 0;
QTranslator *tor = new QTranslator;
- tor->load("hellotr_la.qm");
+ QVERIFY(tor->load("hellotr_la.qm"));
qApp->sendPostedEvents();
qApp->sendPostedEvents();
QCOMPARE(languageChangeEventCounter, 0);
- tor->load("doesn't exist, same as clearing");
+ QVERIFY(!tor->load("doesn't exist, same as clearing"));
qApp->sendPostedEvents();
qApp->sendPostedEvents();
QCOMPARE(languageChangeEventCounter, 0);
- tor->load("hellotr_la.qm");
+ QVERIFY(tor->load("hellotr_la.qm"));
qApp->sendPostedEvents();
qApp->sendPostedEvents();
QCOMPARE(languageChangeEventCounter, 0);
@@ -201,12 +201,12 @@ void tst_QTranslator::testLanguageChange()
qApp->sendPostedEvents();
QCOMPARE(languageChangeEventCounter, 1);
- tor->load("doesn't exist, same as clearing");
+ QVERIFY(!tor->load("doesn't exist, same as clearing"));
qApp->sendPostedEvents();
qApp->sendPostedEvents();
QCOMPARE(languageChangeEventCounter, 2);
- tor->load("hellotr_la.qm");
+ QVERIFY(tor->load("hellotr_la.qm"));
qApp->sendPostedEvents();
qApp->sendPostedEvents();
QCOMPARE(languageChangeEventCounter, 3);
@@ -216,7 +216,7 @@ void tst_QTranslator::testLanguageChange()
qApp->sendPostedEvents();
QCOMPARE(languageChangeEventCounter, 4);
- tor->load("doesn't exist, same as clearing");
+ QVERIFY(!tor->load("doesn't exist, same as clearing"));
qApp->sendPostedEvents();
qApp->sendPostedEvents();
QCOMPARE(languageChangeEventCounter, 4);
@@ -226,7 +226,7 @@ void tst_QTranslator::testLanguageChange()
qApp->sendPostedEvents();
QCOMPARE(languageChangeEventCounter, 4);
- tor->load("hellotr_la.qm");
+ QVERIFY(tor->load("hellotr_la.qm"));
qApp->sendPostedEvents();
qApp->sendPostedEvents();
QCOMPARE(languageChangeEventCounter, 5);
@@ -243,7 +243,7 @@ void tst_QTranslator::plural()
{
QTranslator tor( 0 );
- tor.load("hellotr_la");
+ QVERIFY(tor.load("hellotr_la"));
QVERIFY(!tor.isEmpty());
QCoreApplication::installTranslator(&tor);
QCOMPARE(QCoreApplication::translate("QPushButton", "Hello %n world(s)!", 0, 0), QLatin1String("Hallo 0 Welten!"));
@@ -254,7 +254,7 @@ void tst_QTranslator::plural()
void tst_QTranslator::translate_qm_file_generated_with_msgfmt()
{
QTranslator translator;
- translator.load("msgfmt_from_po");
+ QVERIFY(translator.load("msgfmt_from_po"));
qApp->installTranslator(&translator);
QCOMPARE(QCoreApplication::translate("", "Intro"), QLatin1String("Einleitung"));
@@ -275,7 +275,7 @@ void tst_QTranslator::loadDirectory()
QVERIFY(QFileInfo("../" + current_base).isDir());
QTranslator tor;
- tor.load(current_base, "..");
+ QVERIFY(!tor.load(current_base, ".."));
QVERIFY(tor.isEmpty());
}
@@ -303,7 +303,7 @@ void tst_QTranslator::dependencies()
QFile file("dependencies_la.qm");
file.open(QFile::ReadOnly);
QByteArray data = file.readAll();
- tor.load((const uchar *)data.constData(), data.length());
+ QVERIFY(tor.load((const uchar *)data.constData(), data.length()));
QVERIFY(!tor.isEmpty());
QCOMPARE(tor.translate("QPushButton", "Hello world!"), QLatin1String("Hallo Welt!"));
}
@@ -347,7 +347,7 @@ void tst_QTranslator::translationInThreadWhileInstallingTranslator()
thread.runningCondition.wait(&thread.startupLock);
QTranslator *tor = new QTranslator;
- tor->load("hellotr_la");
+ QVERIFY(tor->load("hellotr_la"));
QCoreApplication::installTranslator(tor);
++thread.terminate;