From 7c89d44d95c1c91f77aca3359cd8964a354fc41c Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 9 Mar 2012 11:06:18 +0200 Subject: Windows: Fix QStyleSheetStyle autotest antialiasing issues Antialiasing of fonts was causing two tests that relied on finding at least a certain number of pixels of certain color to find one or two too few pixels of that color and thus fail. Fixed by increasing the amount of text displayed to make sure enough pixels of correct color would be present. Also removing the test insignification, as the test will now pass completely when run under Windows Classic theme, which CI uses. Task-number: QTBUG-24323 Change-Id: Ic0b614d33e4e4f5df18d53cb72a05db5d8b6b5e7 Reviewed-by: Friedemann Kleint --- .../styles/qstylesheetstyle/qstylesheetstyle.pro | 2 -- .../qstylesheetstyle/tst_qstylesheetstyle.cpp | 30 +++++++++++++--------- 2 files changed, 18 insertions(+), 14 deletions(-) (limited to 'tests/auto/widgets/styles') diff --git a/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro b/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro index dd17183b30..c96004bd5d 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro +++ b/tests/auto/widgets/styles/qstylesheetstyle/qstylesheetstyle.pro @@ -6,5 +6,3 @@ SOURCES += tst_qstylesheetstyle.cpp RESOURCES += resources.qrc requires(contains(QT_CONFIG,private_tests)) - -win32:CONFIG += insignificant_test # QTBUG-24323 diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index 544923a1c3..3bff332252 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -728,22 +728,27 @@ void tst_QStyleSheetStyle::focusColors() // is reached if at least ten pixels of the right color can be found in // the image. // For this reason, we use unusual and extremely ugly colors! :-) + // Note that in case of anti-aliased text, ensuring that we have at least + // ten pixels of the right color requires quite a many characters, as the + // majority of the pixels will have slightly different colors due to the + // anti-aliasing effect. #if !defined(Q_OS_WIN32) && !defined(Q_OS_MAC) && !(defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(Q_CC_INTEL)) QSKIP("This is a fragile test which fails on many esoteric platforms because of focus problems. " "That doesn't mean that the feature doesn't work in practice."); #endif QList widgets; - widgets << new QPushButton("TESTING"); - widgets << new QLineEdit("TESTING"); - widgets << new QLabel("TESTING"); + widgets << new QPushButton("TESTING TESTING"); + widgets << new QLineEdit("TESTING TESTING"); + widgets << new QLabel("TESTING TESTING"); QSpinBox *spinbox = new QSpinBox; - spinbox->setValue(8888); + spinbox->setMaximum(1000000000); + spinbox->setValue(123456789); widgets << spinbox; QComboBox *combobox = new QComboBox; combobox->setEditable(true); - combobox->addItems(QStringList() << "TESTING"); + combobox->addItems(QStringList() << "TESTING TESTING"); widgets << combobox; - widgets << new QLabel("TESTING"); + widgets << new QLabel("TESTING TESTING"); #ifdef Q_WS_QWS // QWS has its own special focus logic which is slightly different @@ -794,17 +799,18 @@ void tst_QStyleSheetStyle::hoverColors() if (!PlatformQuirks::haveMouseCursor()) QSKIP("No mouse Cursor on this platform"); QList widgets; - widgets << new QPushButton("TESTING"); - widgets << new QLineEdit("TESTING"); - widgets << new QLabel("TESTING"); + widgets << new QPushButton("TESTING TESTING"); + widgets << new QLineEdit("TESTING TESTING"); + widgets << new QLabel("TESTING TESTING"); QSpinBox *spinbox = new QSpinBox; - spinbox->setValue(8888); + spinbox->setMaximum(1000000000); + spinbox->setValue(123456789); widgets << spinbox; QComboBox *combobox = new QComboBox; combobox->setEditable(true); - combobox->addItems(QStringList() << "TESTING"); + combobox->addItems(QStringList() << "TESTING TESTING"); widgets << combobox; - widgets << new QLabel("TESTING"); + widgets << new QLabel("TESTING TESTING"); foreach (QWidget *widget, widgets) { //without Qt::X11BypassWindowManagerHint the window manager may move the window after we moved the cursor -- cgit v1.2.3