summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2021-03-11 14:01:28 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-03-11 23:35:52 +0000
commit42f364c4945b7fe504817c5dc24f3ab8a4456dbd (patch)
tree50db1533176dc44dad3eaaf8fa91314a2d188d7c /tests
parentcc6f0a6c35aea011b3057fce869cb3fbecbf7048 (diff)
Revert "QPushButton: fix support of style sheet rule for text alignment"
This reverts commit 6269438af95bbd988ead08829fa3bc9dc25891e8, and adds a test. This change introduced QTBUG-91735, without fixing QTBUG-86857 correctly. The code already interprets the textAlignment values from the rule, also if no icon is set. Adding the same, or some default textAlignment to the text flags if there is no icon doesn't work. Fixes: QTBUG-91735 Task-number: QTBUG-86857 Change-Id: Iee07e63a40e72909275f32e1caa28b33a595f879 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 674747bac1c8b57d4940de2ee68b6b562dfcad61) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
index f8464e2383..5469d35f19 100644
--- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
+++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp
@@ -73,6 +73,7 @@ private slots:
#endif
void emitReleasedAfterChange();
void hitButton();
+ void iconOnlyStyleSheet();
protected slots:
void resetCounters();
@@ -734,5 +735,22 @@ void tst_QPushButton::hitButton()
QVERIFY(!button2->hitButton(QPoint(2, 2)));
}
+/*
+ Test that a style sheet with only icon doesn't crash.
+ QTBUG-91735
+*/
+void tst_QPushButton::iconOnlyStyleSheet()
+{
+ QIcon icon(":/qt-project.org/styles/commonstyle/images/dvd-32.png");
+ QVERIFY(!icon.isNull());
+ QPushButton pb;
+ pb.setStyleSheet("QPushButton {"
+ "icon: url(:/qt-project.org/styles/commonstyle/images/dvd-32.png);"
+ "border: red;"
+ "}");
+ pb.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&pb));
+}
+
QTEST_MAIN(tst_QPushButton)
#include "tst_qpushbutton.moc"