diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-03-24 19:12:58 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-03-25 09:02:52 (GMT) |
commit | c3776865dd3731917adf9a8ec8cdffb79a579bae (patch) | |
tree | 241a89f684101e8e98026f34e49850dd37f968a4 /tests | |
parent | b409dab4a97acdbc2c89a43f25d57be1277aea1d (diff) | |
download | Qt-c3776865dd3731917adf9a8ec8cdffb79a579bae.zip Qt-c3776865dd3731917adf9a8ec8cdffb79a579bae.tar.gz Qt-c3776865dd3731917adf9a8ec8cdffb79a579bae.tar.bz2 |
Fix scrollbar appearing on QComboBox
aefadefae655972287b196e6c0f0563c4fb4666c was not good enough
Task-number: 248094
Reviewed-by: Jens Bache-Wiig <jbache@trolltech.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qcombobox/tst_qcombobox.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index 0db9fdf..dbe2f22 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -56,6 +56,7 @@ #include <qlistwidget.h> #include <qtreewidget.h> #include <qtablewidget.h> +#include <qscrollbar.h> #ifdef Q_WS_MAC #include <qmacstyle_mac.h> #elif defined Q_WS_X11 @@ -138,6 +139,8 @@ private slots: void task248169_popupWithMinimalSize(); void task247863_keyBoardSelection(); void setModelColumn(); + void noScrollbar_data(); + void noScrollbar(); protected slots: void onEditTextChanged( const QString &newString ); @@ -2178,5 +2181,56 @@ void tst_QComboBox::setModelColumn() QCOMPARE(box.currentText(), QString("zero")); } +void tst_QComboBox::noScrollbar_data() +{ + QTest::addColumn<QString>("stylesheet"); + + QTest::newRow("normal") << QString(); + QTest::newRow("border") << QString::fromLatin1("QAbstractItemView { border: 12px solid blue;}"); + QTest::newRow("margin") << QString::fromLatin1("QAbstractItemView { margin: 12px 15px 13px 10px; }"); + QTest::newRow("padding") << QString::fromLatin1("QAbstractItemView { padding: 12px 15px 13px 10px;}"); + QTest::newRow("everything") << QString::fromLatin1("QAbstractItemView { border: 12px solid blue; " + " padding: 12px 15px 13px 10px; margin: 12px 15px 13px 10px; }"); + QTest::newRow("everything and more") << QString::fromLatin1("QAbstractItemView { border: 1px 3px 5px 1px solid blue; " + " padding: 2px 5px 3px 1px; margin: 2px 5px 3px 1px; } " + " QAbstractItemView::item { border: 2px solid green; " + " padding: 1px 1px 2px 2px margin: 1px; } " ); +} + +void tst_QComboBox::noScrollbar() +{ + QStringList initialContent; + initialContent << "foo" << "bar" << "foobar" << "moo"; + QFETCH(QString, stylesheet); + + { + QComboBox comboBox; + comboBox.setStyleSheet(stylesheet); + comboBox.addItems(initialContent); + comboBox.show(); + comboBox.resize(200, comboBox.height()); + QTest::qWait(100); + comboBox.showPopup(); + QTest::qWait(100); + QVERIFY(!comboBox.view()->horizontalScrollBar()->isVisible()); + QVERIFY(!comboBox.view()->verticalScrollBar()->isVisible()); + } + + { + QTableWidget *table = new QTableWidget(2,2); + QComboBox comboBox; + comboBox.setStyleSheet(stylesheet); + comboBox.setView(table); + comboBox.setModel(table->model()); + comboBox.show(); + QTest::qWait(100); + comboBox.resize(200, comboBox.height()); + comboBox.showPopup(); + QTest::qWait(100); + QVERIFY(!comboBox.view()->horizontalScrollBar()->isVisible()); + QVERIFY(!comboBox.view()->verticalScrollBar()->isVisible()); + } +} + QTEST_MAIN(tst_QComboBox) #include "tst_qcombobox.moc" |