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