diff --git a/tests/testutils/process.cpp b/tests/testutils/process.cpp index f2f27d5..c5c57f2 100644 --- a/tests/testutils/process.cpp +++ b/tests/testutils/process.cpp @@ -25,7 +25,7 @@ Process::Process() : m_expectFail(false), m_timedOut(false) {} QString Process::execute(const QString &program, const QStringList &arguments, bool expectedResult){ - Q_ASSERT(processStatus() == NotRunning); + Q_ASSERT(m_process.state() == QProcess::NotRunning); m_program = program; m_arguments = arguments; m_expectFail = expectedResult == ExpectFail; diff --git a/tests/ut_settings/settingstest.cpp b/tests/ut_settings/settingstest.cpp index 079103f..0fd8cfd 100644 --- a/tests/ut_settings/settingstest.cpp +++ b/tests/ut_settings/settingstest.cpp @@ -112,13 +112,13 @@ void SettingsTest::testUpgrade_data(){ const QString key = group.isEmpty() ? testCase.key() : group + '/' + testCase.key(); QTest::newRow(qPrintable(QString("%1%2:%3:%4") .arg(group.isEmpty() ? "" : group + "/") - .arg(testCase.history) - .arg(testCase.current) - .arg(testCase.expected))) + .arg(testCase.history()) + .arg(testCase.current()) + .arg(testCase.expected()))) << ssuSettings.contains(key) << testCase.keyShouldBeSet() << ssuSettings.value(key).toString() - << testCase.expected; + << testCase.expected(); } } } diff --git a/tests/ut_settings/upgradetesthelper.cpp b/tests/ut_settings/upgradetesthelper.cpp index 55e167d..3d80053 100644 --- a/tests/ut_settings/upgradetesthelper.cpp +++ b/tests/ut_settings/upgradetesthelper.cpp @@ -110,8 +110,8 @@ void UpgradeTestHelper::fillSettings(QSettings *settings, const QList settings->beginGroup(group); foreach (const TestCase &testCase, testCases){ - if (!testCase.current.isEmpty()){ - settings->setValue(testCase.key(), testCase.current); + if (!testCase.current().isEmpty()){ + settings->setValue(testCase.key(), testCase.current()); } } @@ -136,7 +136,7 @@ void UpgradeTestHelper::fillDefaultSettings(QSettings *defaultSettings, const QL defaultSettings->beginGroup(group); foreach (const TestCase &testCase, testCases){ - switch (testCase.history.at(revision - 1).toAscii()){ + switch (testCase.history().at(revision - 1).toAscii()){ case 'S': // (S)et value lastSetValue[testCase.key()] = QString("v%1-default").arg(revision); defaultSettings->setValue(testCase.key(), lastSetValue[testCase.key()]); @@ -144,7 +144,7 @@ void UpgradeTestHelper::fillDefaultSettings(QSettings *defaultSettings, const QL case 'K': // (K)eep value Q_ASSERT_X(!lastSetValue[testCase.key()].isEmpty(), Q_FUNC_INFO, - qPrintable(QString("Inalid TestCase::history: '%1'").arg(testCase.history))); + qPrintable(QString("Inalid TestCase::history: '%1'").arg(testCase.history()))); defaultSettings->setValue(testCase.key(), lastSetValue[testCase.key()]); break; @@ -159,8 +159,8 @@ void UpgradeTestHelper::fillDefaultSettings(QSettings *defaultSettings, const QL default: Q_ASSERT_X(false, Q_FUNC_INFO, qPrintable(QString( "Inalid TestCase::history: '%1': invalid command-code '%2'") - .arg(testCase.history) - .arg(testCase.history.at(revision - 1)))); + .arg(testCase.history()) + .arg(testCase.history().at(revision - 1)))); } } @@ -242,8 +242,8 @@ bool UpgradeTestHelper::generateSnapshotRecipe(QTextStream *out){ ? ssuSettings.value(testCase.key()).toString() : "@NOTSET@"; *out << QString("%1:%2:%3\n") - .arg(testCase.history) - .arg(testCase.current) + .arg(testCase.history()) + .arg(testCase.current()) .arg(expected); } diff --git a/tests/ut_settings/upgradetesthelper.h b/tests/ut_settings/upgradetesthelper.h index 13d3d7a..388cc5e 100644 --- a/tests/ut_settings/upgradetesthelper.h +++ b/tests/ut_settings/upgradetesthelper.h @@ -31,20 +31,24 @@ class UpgradeTestHelper { struct UpgradeTestHelper::TestCase { TestCase(const QString &history, const QString ¤t, const QString &expected) : - history(history), current(current), expected(expected){ + m_history(history), m_current(current), m_expected(expected){ } + QString history() const { return m_history; } + QString current() const { return m_current; } + QString expected() const { return m_expected; } + QString key() const{ - return QString("%1__%2").arg(history).arg(current); + return QString("%1__%2").arg(m_history).arg(m_current); } bool keyShouldBeSet() const{ - return expected != "@NOTSET@"; + return m_expected != "@NOTSET@"; } - const QString history; // Sequence of (S)et, (K)eep, (R)emove, (N)oop - const QString current; - const QString expected; + QString m_history; // Sequence of (S)et, (K)eep, (R)emove, (N)oop + QString m_current; + QString m_expected; }; #endif