Changeset View
Changeset View
Standalone View
Standalone View
autotests/KDbTestUtils.h
Show All 16 Lines | |||||
17 | * Boston, MA 02110-1301, USA. | 17 | * Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #ifndef KDB_TESTUTILS_H | 20 | #ifndef KDB_TESTUTILS_H | ||
21 | #define KDB_TESTUTILS_H | 21 | #define KDB_TESTUTILS_H | ||
22 | 22 | | |||
23 | #include "kdbtestutils_export.h" | 23 | #include "kdbtestutils_export.h" | ||
24 | 24 | | |||
25 | #include <QPointer> | 25 | #include <KDbConnection> | ||
26 | #include <QTest> | 26 | #include <KDbConnectionOptions> | ||
27 | #include <KDbDriver> | 27 | #include <KDbDriver> | ||
28 | #include <KDbDriverManager> | 28 | #include <KDbDriverManager> | ||
29 | #include <KDbConnection> | 29 | | ||
30 | #include <QPointer> | ||||
31 | #include <QTest> | ||||
30 | 32 | | |||
31 | Q_DECLARE_METATYPE(KDbField::TypeGroup) | 33 | Q_DECLARE_METATYPE(KDbField::TypeGroup) | ||
32 | Q_DECLARE_METATYPE(KDbField::Type) | 34 | Q_DECLARE_METATYPE(KDbField::Type) | ||
33 | Q_DECLARE_METATYPE(KDb::Signedness) | 35 | Q_DECLARE_METATYPE(KDb::Signedness) | ||
34 | Q_DECLARE_METATYPE(QList<KDbField::Type>) | 36 | Q_DECLARE_METATYPE(QList<KDbField::Type>) | ||
35 | Q_DECLARE_METATYPE(KDb::BLOBEscapingType) | 37 | Q_DECLARE_METATYPE(KDb::BLOBEscapingType) | ||
36 | 38 | | |||
37 | //! @internal for KDB_VERIFY | 39 | //! @internal for KDB_VERIFY | ||
▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Line(s) | 106 | public: | |||
105 | KDbTestUtils(); | 107 | KDbTestUtils(); | ||
106 | 108 | | |||
107 | KDbDriverManager manager; | 109 | KDbDriverManager manager; | ||
108 | QPointer<KDbDriver> driver; | 110 | QPointer<KDbDriver> driver; | ||
109 | QScopedPointer<KDbConnection> connection; | 111 | QScopedPointer<KDbConnection> connection; | ||
110 | 112 | | |||
111 | KDBTEST_METHOD_DECL(testDriverManager, (), ()); | 113 | KDBTEST_METHOD_DECL(testDriverManager, (), ()); | ||
112 | KDBTEST_METHOD_DECL(testSqliteDriver, (), ()); | 114 | KDBTEST_METHOD_DECL(testSqliteDriver, (), ()); | ||
113 | KDBTEST_METHOD_DECL(testConnect, (const KDbConnectionData &cdata), (cdata)); | 115 | | ||
116 | //! Connects to a database | ||||
117 | //! @since 3.2 | ||||
118 | KDBTEST_METHOD_DECL(testConnect, | ||||
119 | (const KDbConnectionData &cdata, | ||||
120 | const KDbConnectionOptions &options = KDbConnectionOptions()), | ||||
121 | (cdata, options)); | ||||
122 | | ||||
114 | KDBTEST_METHOD_DECL(testUse, (), ()); | 123 | KDBTEST_METHOD_DECL(testUse, (), ()); | ||
115 | 124 | | |||
125 | //! Convenience method that performs testConnect and testUse in one go | ||||
126 | //! @since 3.2 | ||||
127 | KDBTEST_METHOD_DECL(testConnectAndUse, | ||||
128 | (const KDbConnectionData &cdata, | ||||
129 | const KDbConnectionOptions &options = KDbConnectionOptions()), | ||||
130 | (cdata, options)); | ||||
131 | | ||||
132 | //! Overload of testConnectAndUse for file-based databases | ||||
133 | //! @since 3.2 | ||||
134 | KDBTEST_METHOD_DECL(testConnectAndUse, | ||||
135 | (const QString &path, | ||||
136 | const KDbConnectionOptions &options = KDbConnectionOptions()), | ||||
137 | (path, options)); | ||||
138 | | ||||
116 | //! Creates database with name @a dbName | 139 | //! Creates database with name @a dbName | ||
117 | //! Does not use the database. | 140 | //! Does not use the database. | ||
118 | //! @todo don't hardcode SQLite here | 141 | //! @todo don't hardcode SQLite here | ||
119 | //! @note dbName should not include ".kexi" extension or path | 142 | //! @note dbName should not include ".kexi" extension or path | ||
120 | KDBTEST_METHOD_DECL(testCreateDb, (const QString &dbName), (dbName)); | 143 | KDBTEST_METHOD_DECL(testCreateDb, (const QString &dbName), (dbName)); | ||
121 | 144 | | |||
122 | //! Creates database with name @a dbName, then uses it and creates test tables | 145 | //! Creates database with name @a dbName, then uses it and creates test tables | ||
123 | //! The database stays used. | 146 | //! The database stays used. | ||
Show All 15 Lines |