From bbe08d6b686456297ad4ab8c0923c3126e02e2b3 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 3 Oct 2018 09:59:06 +0200 Subject: QCss: properly parse functions which contains additional spaces When there were additional spaces between the function definition and the first parameter, the parser failed to parse it when it contained another function (e.g. 'qlineargradient(... rgb() ...)'). The reason for this was that ::until() needs the function at index-1 so it can correctly count the opening parenthesis. Fixes: QTBUG-61795 Change-Id: I992f556e7f8cd45550f83bc90aa8de2b4e905574 Reviewed-by: Richard Moe Gustavsen --- tests/auto/gui/text/qcssparser/tst_qcssparser.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp index 2a53f5d633..cfd24a8701 100644 --- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp @@ -1509,6 +1509,12 @@ void tst_QCssParser::gradient_data() "spread: repeat, stop:0.2 rgb(1, 2, 3), stop:0.5 rgba(1, 2, 3, 4))" << "conical" << QPointF(4, 2) << QPointF() << 2 << qreal(0.2) << QColor(1, 2, 3) << qreal(0.5) << QColor(1, 2, 3, 4); + // spaces before first function parameter lead to parser errors + QTest::newRow("QTBUG-61795") << + "selection-background-color: qconicalgradient( cx: 4, cy : 2, angle: 23, " + "spread: repeat, stop:0.2 rgb( 1, 2, 3), stop:0.5 rgba( 1, 2, 3, 4))" << "conical" << QPointF(4, 2) << QPointF() + << 2 << qreal(0.2) << QColor(1, 2, 3) << qreal(0.5) << QColor(1, 2, 3, 4); + /* won't pass: stop values are expected to be sorted QTest::newRow("unsorted-stop") << "selection-background: lineargradient(x1:0, y1:0, x2:0, y2:1, " -- cgit v1.2.3