some refactor

This commit is contained in:
Agel committed 2026-10-30 12:00:49 +01:00
1 parent 870bd1c0be
commit c25e8ddb90
20 files changed
+1204 -948

No files matched your search

+10 -3
View File
@@ -111,12 +111,19 @@ private slots:
QDomElement p = doc.elementsByTagName(QStringLiteral("p")).at(0).toElement();
auto decls = Css::cascade(sheet, p);
QString serialized = Css::serialize(decls);
bool hasBold = false;
bool hasRed = false;
for (const auto &d : decls) {
if (d.property == QLatin1String("font-weight") && d.value == QLatin1String("bold"))
hasBold = true;
if (d.property == QLatin1String("color") && d.value == QLatin1String("red"))
hasRed = true;
}
// font-weight: bold should match div > p.highlight
QVERIFY(serialized.contains(QStringLiteral("font-weight:bold")));
QVERIFY(hasBold);
// color: red should win because it is !important in #special, beating inline style="color: green"
QVERIFY(serialized.contains(QStringLiteral("color:red")));
QVERIFY(hasRed);
}
};