Changeset View
Changeset View
Standalone View
Standalone View
autotest/grantleethemetest.cpp
Show All 19 Lines | |||||
20 | #include "grantleetheme.h" | 20 | #include "grantleetheme.h" | ||
21 | 21 | | |||
22 | #include <qtest.h> | 22 | #include <qtest.h> | ||
23 | #include <QDir> | 23 | #include <QDir> | ||
24 | #include <QPalette> | 24 | #include <QPalette> | ||
25 | #include <QProcess> | 25 | #include <QProcess> | ||
26 | #include <QStandardPaths> | 26 | #include <QStandardPaths> | ||
27 | 27 | | |||
28 | #include <KColorScheme> | ||||
28 | #include <KConfigGroup> | 29 | #include <KConfigGroup> | ||
29 | #include <KSharedConfig> | 30 | #include <KSharedConfig> | ||
30 | 31 | | |||
31 | GrantleeThemeTest::GrantleeThemeTest(QObject *parent) | 32 | GrantleeThemeTest::GrantleeThemeTest(QObject *parent) | ||
32 | : QObject(parent) | 33 | : QObject(parent) | ||
33 | { | 34 | { | ||
34 | QStandardPaths::setTestModeEnabled(true); | 35 | QStandardPaths::setTestModeEnabled(true); | ||
35 | 36 | | |||
▲ Show 20 Lines • Show All 158 Lines • ▼ Show 20 Line(s) | 182 | { | |||
194 | data[QStringLiteral("subtext")] = QStringLiteral("Please wait, it will be over soon."); | 195 | data[QStringLiteral("subtext")] = QStringLiteral("Please wait, it will be over soon."); | ||
195 | 196 | | |||
196 | QPalette pal; | 197 | QPalette pal; | ||
197 | pal.setColor(QPalette::Button, Qt::red); | 198 | pal.setColor(QPalette::Button, Qt::red); | ||
198 | pal.setColor(QPalette::Active, QPalette::Base, Qt::red); | 199 | pal.setColor(QPalette::Active, QPalette::Base, Qt::red); | ||
199 | pal.setColor(QPalette::Inactive, QPalette::Base, Qt::green); | 200 | pal.setColor(QPalette::Inactive, QPalette::Base, Qt::green); | ||
200 | pal.setColor(QPalette::Disabled, QPalette::Base, Qt::blue); | 201 | pal.setColor(QPalette::Disabled, QPalette::Base, Qt::blue); | ||
201 | data[QStringLiteral("pal")] = QVariant::fromValue(pal); | 202 | data[QStringLiteral("pal")] = QVariant::fromValue(pal); | ||
203 | data[QStringLiteral("colorScheme")] = QVariant::fromValue(KColorScheme(QPalette::Normal, KColorScheme::View)); | ||||
202 | 204 | | |||
203 | GrantleeTheme::Theme theme(themePath, dirname, filename); | 205 | GrantleeTheme::Theme theme(themePath, dirname, filename); | ||
204 | QCOMPARE(theme.isValid(), isValid); | 206 | QCOMPARE(theme.isValid(), isValid); | ||
205 | 207 | | |||
206 | if (isValid) { | 208 | if (isValid) { | ||
207 | const QString result = theme.render(templateBasename + QStringLiteral(".html"), data); | 209 | const QString result = theme.render(templateBasename + QStringLiteral(".html"), data); | ||
208 | 210 | | |||
209 | QVERIFY(validateHtml(themePath, templateBasename, result)); | 211 | QVERIFY(validateHtml(themePath, templateBasename, result)); | ||
210 | QVERIFY(compareHtml(themePath, templateBasename)); | 212 | QVERIFY(compareHtml(themePath, templateBasename)); | ||
211 | 213 | | |||
212 | QFile::remove(themePath + QDir::separator() + templateBasename + QStringLiteral(".out")); | 214 | QFile::remove(themePath + QDir::separator() + templateBasename + QStringLiteral(".out")); | ||
213 | QFile::remove(themePath + QDir::separator() + templateBasename + QStringLiteral(".out.html")); | 215 | QFile::remove(themePath + QDir::separator() + templateBasename + QStringLiteral(".out.html")); | ||
214 | } | 216 | } | ||
215 | } | 217 | } | ||
216 | 218 | | |||
217 | QTEST_GUILESS_MAIN(GrantleeThemeTest) | 219 | QTEST_GUILESS_MAIN(GrantleeThemeTest) |