Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix build errors in debug mode
  • Loading branch information
martyone committed Apr 9, 2013
1 parent 9dbf523 commit f793326
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
2 changes: 1 addition & 1 deletion tests/testutils/process.cpp
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions tests/ut_settings/settingstest.cpp
Expand Up @@ -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();
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions tests/ut_settings/upgradetesthelper.cpp
Expand Up @@ -110,8 +110,8 @@ void UpgradeTestHelper::fillSettings(QSettings *settings, const QList<TestCase>
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());
}
}

Expand All @@ -136,15 +136,15 @@ 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()]);
break;

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;

Expand All @@ -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))));
}

}
Expand Down Expand Up @@ -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);
}

Expand Down
16 changes: 10 additions & 6 deletions tests/ut_settings/upgradetesthelper.h
Expand Up @@ -31,20 +31,24 @@ class UpgradeTestHelper {

struct UpgradeTestHelper::TestCase {
TestCase(const QString &history, const QString &current, 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

0 comments on commit f793326

Please sign in to comment.