597
597
QColor paletteColor = theme->getPaletteColor("normal", "background");
598
598
QCOMPARE(paletteColor, expected);
601
void test_switch_values_palettechanges_data()
603
QTest::addColumn<QString>("test");
604
QTest::addColumn<QString>("properties");
606
QTest::newRow("Switch background") << "SwitchOnePaletteValue.qml" << "background";
607
QTest::newRow("Switch background, overlay") << "SwitchFewPaletteValues.qml" << "background,overlay";
608
QTest::newRow("Switch all") << "SwitchFewPaletteValues.qml" << "*";
611
void test_switch_values_palettechanges()
613
QFETCH(QString, test);
614
QFETCH(QString, properties);
615
QStringList propertyList = properties.split(',', QString::SkipEmptyParts);
617
qputenv("UBUNTU_UI_TOOLKIT_THEMES_PATH", "");
618
qputenv("XDG_DATA_DIRS", "./themes");
620
QScopedPointer<ThemeTestCase> view(new ThemeTestCase(test));
621
UCTheme *theme = view->findItem<UCTheme*>("testSet");
622
UCTheme *mainTheme = UCStyledItemBasePrivate::get(qobject_cast<UCStyledItemBase*>(view->rootObject()))->getTheme();
623
if (properties == "*") {
624
// test all properties
625
propertyList.clear();
626
const QMetaObject *mo = theme->palette()->property("normal").value<QObject*>()->metaObject();
627
for (int i = mo->propertyOffset(); i < mo->propertyCount(); i++) {
628
propertyList << mo->property(i).name();
632
// compare mainTheme.normal with mainTheme.selected values
633
Q_FOREACH(const QString &property, propertyList) {
634
QColor mainColor = mainTheme->getPaletteColor("normal", property.toLocal8Bit());
635
QColor testColor = theme->getPaletteColor("selected", property.toLocal8Bit());
636
QVERIFY2(mainColor == testColor, (QString("%1 color value differs").arg(property)).toLocal8Bit());
642
602
QTEST_MAIN(tst_Subtheming)