summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
diff options
context:
space:
mode:
authorAxel Spoerl <axel.spoerl@qt.io>2023-05-18 11:15:43 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2023-05-22 14:45:26 +0000
commit980a499ad0a4d30806d8c40e89b8d06419915a77 (patch)
tree20697c529bf5ccddce7c7bbf2034698bfbc254fb /tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
parent227b639499d7e9ebabd6e07e80f2c5c63a6a2154 (diff)
Implement color role AccentColor in QStyleSheetStyle and QCssParser
The color role AccentColor has been added to QPalette. This patch implements the new color role in QCssParser and subsequently in QStyleSheetStyle. The QBrush variable names used to populate brushes, have been changed into speaking names for better code readability. tst_QCssParser has been adapted accordingly. The test function accentColor() has been added in tst_QStyleSheetStyle. Documentation has been updated. Change-Id: Ib09ddc1b61868f2bb8f70f654e83ea1c35276d30 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/gui/text/qcssparser/tst_qcssparser.cpp')
-rw-r--r--tests/auto/gui/text/qcssparser/tst_qcssparser.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
index 5ca983450a..778c4a002e 100644
--- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
+++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp
@@ -1543,20 +1543,26 @@ void tst_QCssParser::gradient()
QList<QCss::StyleRule> rules = testSelector.styleRulesForNode(n);
QList<QCss::Declaration> decls = rules.at(0).declarations;
QCss::ValueExtractor ve(decls);
- QBrush fg, sfg, pfg;
- QBrush sbg, abg;
- QVERIFY(ve.extractPalette(&fg, &sfg, &sbg, &abg, &pfg));
+ QBrush foreground;
+ QBrush selectedForeground;
+ QBrush selectedBackground;
+ QBrush alternateBackground;
+ QBrush placeHolderTextForeground;
+ QBrush accentColor;
+ QVERIFY(ve.extractPalette(&foreground, &selectedForeground, &selectedBackground,
+ &alternateBackground, &placeHolderTextForeground, &accentColor));
+
if (type == "linear") {
- QCOMPARE(sbg.style(), Qt::LinearGradientPattern);
- const QLinearGradient *lg = static_cast<const QLinearGradient *>(sbg.gradient());
+ QCOMPARE(selectedBackground.style(), Qt::LinearGradientPattern);
+ const auto *lg = static_cast<const QLinearGradient *>(selectedBackground.gradient());
QCOMPARE(lg->start(), start);
QCOMPARE(lg->finalStop(), finalStop);
} else if (type == "conical") {
- QCOMPARE(sbg.style(), Qt::ConicalGradientPattern);
- const QConicalGradient *cg = static_cast<const QConicalGradient *>(sbg.gradient());
+ QCOMPARE(selectedBackground.style(), Qt::ConicalGradientPattern);
+ const auto *cg = static_cast<const QConicalGradient *>(selectedBackground.gradient());
QCOMPARE(cg->center(), start);
}
- const QGradient *g = sbg.gradient();
+ const QGradient *g = selectedBackground.gradient();
QCOMPARE(g->spread(), QGradient::Spread(spread));
QCOMPARE(g->stops().at(0).first, stop0);
QCOMPARE(g->stops().at(0).second, color0);