[plasma/union] autotests: autotests: Make TestStyle work correctly again
Arjen Hiemstra <[email protected]> Wed, 5 Aug 2026 10:33:24 +0000 (UTC)
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 7b21f491b35ae1c943870df52ddc00cf7496b0a4 by Arjen Hiemstra.
Committed on 05/08/2026 at 10:24.
Pushed by ahiemstra into branch 'master'.
autotests: Make TestStyle work correctly again
TestStyleLoader now requires a valid path otherwise it can't load data.
M +11 -3 autotests/TestStyle.cpp
https://invent.kde.org/plasma/union/-/commit/7b21f491b35ae1c943870df52ddc00cf7496b0a4
diff --git a/autotests/TestStyle.cpp b/autotests/TestStyle.cpp
index 568b2b5e..f1b69043 100644
--- a/autotests/TestStyle.cpp
+++ b/autotests/TestStyle.cpp
@@ -17,18 +17,18 @@ class TestStyle : public QObject
private Q_SLOTS:
void testLoad()
{
- auto style = Style::create(std::filesystem::path(), std::make_unique<TestStyleLoader>());
+ auto style = Style::create(FINDTESTPATH("TestStylePackageData/ValidTestStyle"), std::make_unique<TestStyleLoader>());
QVERIFY(style->load());
const auto rules = style->rules();
- QCOMPARE(rules.size(), 1);
+ QCOMPARE(rules.size(), 2);
}
void testMatches()
{
- auto style = Style::create(std::filesystem::path(), std::make_unique<TestStyleLoader>());
+ auto style = Style::create(FINDTESTPATH("TestStylePackageData/ValidTestStyle"), std::make_unique<TestStyleLoader>());
QVERIFY(style->load());
QList<Element::Ptr> elements;
@@ -44,6 +44,14 @@ private Q_SLOTS:
element->setType(u"test"_s);
elements.append(element);
+ result = style->matches(elements);
+ QCOMPARE(result.size(), 1);
+
+ elements.clear();
+ element = Element::create();
+ element->setHint(u"test"_s);
+ elements.append(element);
+
result = style->matches(elements);
QCOMPARE(result.size(), 0);
}