Skip to content

Latest commit

 

History

History
67 lines (54 loc) · 1.44 KB

upgradetesthelper.h

File metadata and controls

67 lines (54 loc) · 1.44 KB
 
Apr 2, 2013
Apr 2, 2013
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;
Oct 10, 2016
Oct 10, 2016
18
19
20
class UpgradeTestHelper
{
public:
Apr 2, 2013
Apr 2, 2013
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 {
Oct 10, 2016
Oct 10, 2016
34
35
36
37
TestCase(const QString &history, const QString &current, const QString &expected) :
m_history(history), m_current(current), m_expected(expected)
{
}
Apr 2, 2013
Apr 2, 2013
38
Oct 10, 2016
Oct 10, 2016
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;
}
Apr 9, 2013
Apr 9, 2013
51
Oct 10, 2016
Oct 10, 2016
52
53
54
55
QString key() const
{
return QString("%1__%2").arg(m_history).arg(m_current);
}
Apr 2, 2013
Apr 2, 2013
56
Oct 10, 2016
Oct 10, 2016
57
58
59
60
bool keyShouldBeSet() const
{
return m_expected != "@NOTSET@";
}
Apr 2, 2013
Apr 2, 2013
61
Oct 10, 2016
Oct 10, 2016
62
63
64
QString m_history; // Sequence of (S)et, (K)eep, (R)emove, (N)oop
QString m_current;
QString m_expected;
Apr 2, 2013
Apr 2, 2013
65
66
67
};
#endif