summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-03-27 14:20:14 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-03-27 14:35:27 (GMT)
commit062c476d378022a49307aca136cb9aab381e0814 (patch)
tree03647c2feb10eb4096842e8a389e7902331392a7 /tests/auto
parente48709416ad314f30d8ea35fc386cb177bb4b32d (diff)
downloadQt-062c476d378022a49307aca136cb9aab381e0814.zip
Qt-062c476d378022a49307aca136cb9aab381e0814.tar.gz
Qt-062c476d378022a49307aca136cb9aab381e0814.tar.bz2
Fix background of QAbstractScrollArea when styled only with pseudo-class
This may happen if you only have something like QAbstractScrollArea:focus { background: foo; } and you do not have a background set for the general case and the viewport has a different background role (such as QTextEdit, QAbstractItemView, ....) This is a regression from 4.4 since in 4.4 the :focus has no effect if you didn't have a background for the general case. Reviewed-by: bnilsen Task-number: 188195
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
index 7954d00..aa63753 100644
--- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -94,6 +94,7 @@ private slots:
void embeddedFonts();
void opaquePaintEvent_data();
void opaquePaintEvent();
+ void task188195_baseBackground();
//at the end because it mess with the style.
void widgetStyle();
@@ -1354,6 +1355,28 @@ void tst_QStyleSheetStyle::opaquePaintEvent()
QCOMPARE(cl.autoFillBackground(), !styled );
}
+void tst_QStyleSheetStyle::task188195_baseBackground()
+{
+ QTreeView tree;
+ tree.setStyleSheet( "QTreeView:disabled { background-color:#ab1251; }" );
+ tree.show();
+ QTest::qWait(20);
+ QImage image(tree.width(), tree.height(), QImage::Format_ARGB32);
+
+ tree.render(&image);
+ QVERIFY(testForColors(image, tree.palette().base().color()));
+ QVERIFY(!testForColors(image, QColor(0xab, 0x12, 0x51)));
+
+ tree.setEnabled(false);
+ tree.render(&image);
+ QVERIFY(testForColors(image, QColor(0xab, 0x12, 0x51)));
+
+ tree.setEnabled(true);
+ tree.render(&image);
+ QVERIFY(testForColors(image, tree.palette().base().color()));
+ QVERIFY(!testForColors(image, QColor(0xab, 0x12, 0x51)));
+}
+
QTEST_MAIN(tst_QStyleSheetStyle)