/
upgradetesthelper.h
67 lines (54 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/**
* @file upgradetesthelper.h
* @copyright 2013 Jolla Ltd.
* @author Martin Kampas <martin.kampas@tieto.com>
* @date 2013
*/
#ifndef _UPGRADETESTHELPER_H
#define _UPGRADETESTHELPER_H
#include <QtCore/QString>
#include <QtCore/QStringList>
class QIODevice;
class QSettings;
class QTextStream;
18
19
20
class UpgradeTestHelper
{
public:
21
22
23
24
25
26
27
28
29
30
31
32
33
enum { HistoryLength = 5, CurrentVersion = 3 };
struct TestCase;
static QList<TestCase> readRecipe(QIODevice *recipe);
static void fillSettings(QSettings *settings, const QList<TestCase> &testCases);
static void fillDefaultSettings(QSettings *defaultSettings, const QList<TestCase> &testCases);
static bool generateSnapshotRecipe(QTextStream *out);
static QStringList groups();
};
struct UpgradeTestHelper::TestCase {
34
35
36
37
TestCase(const QString &history, const QString ¤t, const QString &expected) :
m_history(history), m_current(current), m_expected(expected)
{
}
38
39
40
41
42
43
44
45
46
47
48
49
50
QString history() const
{
return m_history;
}
QString current() const
{
return m_current;
}
QString expected() const
{
return m_expected;
}
51
52
53
54
55
QString key() const
{
return QString("%1__%2").arg(m_history).arg(m_current);
}
56
57
58
59
60
bool keyShouldBeSet() const
{
return m_expected != "@NOTSET@";
}
61
62
63
64
QString m_history; // Sequence of (S)et, (K)eep, (R)emove, (N)oop
QString m_current;
QString m_expected;
65
66
67
};
#endif