summaryrefslogtreecommitdiffstats
path: root/tests/auto/qcombobox
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-10-04 13:23:23 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-05 06:15:00 +0200
commit253497b7446c7d723aa3bdd7152e25d6852f2604 (patch)
treee91eb9fdb94aae121fa587ab5f54f3917a6c1d55 /tests/auto/qcombobox
parent3f88da82b1bdf79fe4c89640838b0b69c8a89d8b (diff)
Avoid using QSKIP in lieu of compile-time checks
QSKIP is intended to be used to skip test functions that are found at run-time to be inapplicable or unsafe. If a test function can be determined to be inapplicable at compile-time, the entire test function should be omitted instead of replacing the body of the test function with a QSKIP, which only serves to slow down test runs and to inflate test run-rates with empty, inapplicable tests. Task-number: QTQAINFRA-278 Change-Id: I582732e3dd657df834f9a98fd52d7ee368f2f29b Reviewed-on: http://codereview.qt-project.org/5946 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/qcombobox')
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp38
1 files changed, 17 insertions, 21 deletions
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp
index 4fe606ee4e..e5ff7e9763 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -137,8 +137,10 @@ private slots:
void itemListPosition();
void separatorItem_data();
void separatorItem();
+#ifndef QT_NO_STYLE_CLEANLOOKS
void task190351_layout();
void task191329_size();
+#endif
void task166349_setEditableOnReturn();
void task190205_setModelAdjustToContents();
void task248169_popupWithMinimalSize();
@@ -151,7 +153,9 @@ private slots:
void task253944_itemDelegateIsReset();
void subControlRectsWithOffset_data();
void subControlRectsWithOffset();
+#ifndef QT_NO_STYLE_WINDOWS
void task260974_menuItemRectangleForComboBoxPopup();
+#endif
void removeItem();
void resetModel();
void keyBoardNavigationWithMouse();
@@ -751,7 +755,7 @@ void tst_QComboBox::insertPolicy()
}
}
-
+// Apps running with valgrind are not fast enough.
void tst_QComboBox::virtualAutocompletion()
{
testWidget->clear();
@@ -784,10 +788,6 @@ void tst_QComboBox::virtualAutocompletion()
qApp->processEvents(); // Process events to trigger autocompletion
QTRY_VERIFY(testWidget->currentIndex() == 1);
-#ifdef QTEST_RUNNING_USING_VALGRIND
- QSKIP("App running with valgrind are not fast enough", SkipAll);
-#endif
-
QKeyEvent kp2(QEvent::KeyPress, Qt::Key_O, 0, "o");
QKeyEvent kr2(QEvent::KeyRelease, Qt::Key_O, 0, "o");
@@ -1976,9 +1976,10 @@ void tst_QComboBox::separatorItem()
}
}
+// This test requires the Cleanlooks style
+#ifndef QT_NO_STYLE_CLEANLOOKS
void tst_QComboBox::task190351_layout()
{
-#ifndef QT_NO_STYLE_CLEANLOOKS
const QString oldStyle = QApplication::style()->objectName();
QApplication::setStyle(new QCleanlooksStyle);
@@ -2010,10 +2011,8 @@ void tst_QComboBox::task190351_layout()
#endif
QApplication::setStyle(oldStyle);
-#else
- QSKIP("Qt configured without cleanlooks style", SkipAll);
-#endif
}
+#endif
class task166349_ComboBox : public QComboBox
{
@@ -2042,9 +2041,10 @@ void tst_QComboBox::task166349_setEditableOnReturn()
QCOMPARE(QLatin1String("two1"), comboBox.itemText(comboBox.count() - 1));
}
+// This test requires the Cleanlooks style.
+#ifndef QT_NO_STYLE_CLEANLOOKS
void tst_QComboBox::task191329_size()
{
-#ifndef QT_NO_STYLE_CLEANLOOKS
const QString oldStyle = QApplication::style()->objectName();
QApplication::setStyle(new QCleanlooksStyle);
@@ -2085,10 +2085,8 @@ void tst_QComboBox::task191329_size()
#endif
QApplication::setStyle(oldStyle);
-#else
- QSKIP("Qt configured without cleanlooks style", SkipAll);
-#endif
}
+#endif
void tst_QComboBox::task190205_setModelAdjustToContents()
{
@@ -2360,11 +2358,10 @@ void tst_QComboBox::subControlRectsWithOffset()
}
+// This test depends on Windows style.
+#ifndef QT_NO_STYLE_WINDOWS
void tst_QComboBox::task260974_menuItemRectangleForComboBoxPopup()
{
-#ifdef QT_NO_STYLE_WINDOWS
- QSKIP("test depends on windows style", QTest::SkipAll);
-#else
class TestStyle: public QWindowsStyle
{
public:
@@ -2397,8 +2394,8 @@ void tst_QComboBox::task260974_menuItemRectangleForComboBoxPopup()
QTRY_VERIFY(style.discoveredRect.width() <= comboBox.width());
}
-#endif
}
+#endif
void tst_QComboBox::removeItem()
{
@@ -2472,10 +2469,8 @@ void tst_QComboBox::keyBoardNavigationWithMouse()
QCOMPARE(combo.currentText(), QLatin1String("0"));
-#ifdef Q_OS_WINCE
- QSKIP("When calling cursor function, Windows CE responds with: This function is not supported on this system.", SkipAll);
-#endif
-
+ // When calling cursor function, Windows CE responds with: This function is not supported on this system.
+#ifndef Q_OS_WINCE
// Force cursor movement to prevent QCursor::setPos() from returning prematurely on QPA:
const QPoint target(combo.view()->mapToGlobal(combo.view()->rect().center()));
QCursor::setPos(QPoint(target.x() + 1, target.y()));
@@ -2505,6 +2500,7 @@ void tst_QComboBox::keyBoardNavigationWithMouse()
QTest::keyClick(combo.view(), Qt::Key_Enter);
QTRY_COMPARE(combo.currentText(), QString::number(final));
+#endif
}
void tst_QComboBox::task_QTBUG_1071_changingFocusEmitsActivated()