diff options
Diffstat (limited to 'tests/auto/widgets')
87 files changed, 451 insertions, 75 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 3b55fcd5fc..7eb682075e 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -1682,6 +1682,23 @@ void tst_QGraphicsGridLayout::sizeHint_data() << QSizeF(100, 100) << QSizeF(100, 100); + QTest::newRow("colSpan_with_ignored_column") << (ItemList() + << ItemDesc(0,0) + .minSize(QSizeF(40,20)) + .maxSize(QSizeF(60,20)) + .colSpan(2) + << ItemDesc(0,2) + .minSize(QSizeF(20, 20)) + .maxSize(QSizeF(30, 20)) + << ItemDesc(1,0) + .minSize(QSizeF(60, 20)) + .maxSize(QSizeF(90, 20)) + .colSpan(3) + ) + << QSizeF(60, 40) + << QSizeF(80, 40) + << QSizeF(90, 40); + } // public QSizeF sizeHint(Qt::SizeHint which, QSizeF const& constraint = QSizeF()) const diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 250790d9fa..04852721db 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -2110,8 +2110,7 @@ void tst_QGraphicsView::sendEvent() QCOMPARE(item->events.at(item->events.size() - 2), QEvent::GraphicsSceneMouseRelease); QCOMPARE(item->events.at(item->events.size() - 1), QEvent::UngrabMouse); - QKeyEvent keyPress(QEvent::KeyPress, Qt::Key_Space, 0); - QApplication::sendEvent(view.viewport(), &keyPress); + QTest::keyPress(view.viewport(), Qt::Key_Space); QCOMPARE(item->events.size(), 9); QCOMPARE(item->events.at(item->events.size() - 2), QEvent::ShortcutOverride); QCOMPARE(item->events.last(), QEvent::KeyPress); diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index ff910ba359..f487e256a3 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp @@ -530,11 +530,16 @@ void tst_QAbstractItemView::basic_tests(TestView *view) // setIconSize view->setIconSize(QSize(16, 16)); QCOMPARE(view->iconSize(), QSize(16, 16)); + QSignalSpy spy(view, &QAbstractItemView::iconSizeChanged); + QVERIFY(spy.isValid()); view->setIconSize(QSize(32, 32)); QCOMPARE(view->iconSize(), QSize(32, 32)); + QCOMPARE(spy.count(), 1); + QCOMPARE(spy.at(0).at(0).value<QSize>(), QSize(32, 32)); // Should this happen? view->setIconSize(QSize(-1, -1)); QCOMPARE(view->iconSize(), QSize(-1, -1)); + QCOMPARE(spy.count(), 2); QCOMPARE(view->currentIndex(), QModelIndex()); QCOMPARE(view->rootIndex(), QModelIndex()); diff --git a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp index 2c3fdb1baa..1616b08fb2 100644 --- a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp +++ b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp @@ -30,9 +30,12 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include <QtGui/QtGui> -#include <QtWidgets/QtWidgets> -#include <QtTest/QtTest> +#include <QDataWidgetMapper> +#include <QStandardItemModel> +#include <QLineEdit> +#include <QComboBox> +#include <QTest> +#include <QSignalSpy> class tst_QDataWidgetMapper: public QObject { diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 408e98b873..eacf2e51fd 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -176,6 +176,7 @@ private slots: void moveSectionAndRemove(); void saveRestore(); void defaultSectionSizeTest(); + void defaultSectionSizeTestStyles(); void defaultAlignment_data(); void defaultAlignment(); @@ -1679,6 +1680,41 @@ void tst_QHeaderView::defaultSectionSizeTest() QVERIFY(hv->sectionSize(2) == 0); // section is hidden. It should not be resized. } +class TestHeaderViewStyle : public QProxyStyle +{ +public: + TestHeaderViewStyle() : horizontalSectionSize(100) {} + int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const Q_DECL_OVERRIDE + { + if (metric == QStyle::PM_HeaderDefaultSectionSizeHorizontal) + return horizontalSectionSize; + else + return QProxyStyle::pixelMetric(metric, option, widget); + } + int horizontalSectionSize; +}; + +void tst_QHeaderView::defaultSectionSizeTestStyles() +{ + TestHeaderViewStyle style1; + TestHeaderViewStyle style2; + style1.horizontalSectionSize = 100; + style2.horizontalSectionSize = 200; + + QHeaderView hv(Qt::Horizontal); + hv.setStyle(&style1); + QCOMPARE(hv.defaultSectionSize(), style1.horizontalSectionSize); + hv.setStyle(&style2); + QCOMPARE(hv.defaultSectionSize(), style2.horizontalSectionSize); + hv.setDefaultSectionSize(70); + QCOMPARE(hv.defaultSectionSize(), 70); + hv.setStyle(&style1); + QCOMPARE(hv.defaultSectionSize(), 70); + hv.resetDefaultSectionSize(); + QCOMPARE(hv.defaultSectionSize(), style1.horizontalSectionSize); + hv.setStyle(&style2); + QCOMPARE(hv.defaultSectionSize(), style2.horizontalSectionSize); +} void tst_QHeaderView::defaultAlignment_data() { diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index f000907e0e..f035094a37 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp @@ -1084,7 +1084,6 @@ void tst_QItemDelegate::decoration() void tst_QItemDelegate::editorEvent_data() { QTest::addColumn<QRect>("rect"); - QTest::addColumn<QString>("text"); QTest::addColumn<int>("checkState"); QTest::addColumn<int>("flags"); QTest::addColumn<bool>("inCheck"); @@ -1093,16 +1092,17 @@ void tst_QItemDelegate::editorEvent_data() QTest::addColumn<bool>("edited"); QTest::addColumn<int>("expectedCheckState"); - QTest::newRow("unchecked, checkable, release") - << QRect(0, 0, 20, 20) - << QString("foo") - << (int)(Qt::Unchecked) - << (int)(Qt::ItemIsEditable + const int defaultFlags = (int)(Qt::ItemIsEditable |Qt::ItemIsSelectable |Qt::ItemIsUserCheckable |Qt::ItemIsEnabled |Qt::ItemIsDragEnabled - |Qt::ItemIsDropEnabled) + |Qt::ItemIsDropEnabled); + + QTest::newRow("unchecked, checkable, release") + << QRect(0, 0, 20, 20) + << (int)(Qt::Unchecked) + << defaultFlags << true << (int)(QEvent::MouseButtonRelease) << (int)(Qt::LeftButton) @@ -1111,14 +1111,8 @@ void tst_QItemDelegate::editorEvent_data() QTest::newRow("checked, checkable, release") << QRect(0, 0, 20, 20) - << QString("foo") << (int)(Qt::Checked) - << (int)(Qt::ItemIsEditable - |Qt::ItemIsSelectable - |Qt::ItemIsUserCheckable - |Qt::ItemIsEnabled - |Qt::ItemIsDragEnabled - |Qt::ItemIsDropEnabled) + << defaultFlags << true << (int)(QEvent::MouseButtonRelease) << (int)(Qt::LeftButton) @@ -1127,14 +1121,8 @@ void tst_QItemDelegate::editorEvent_data() QTest::newRow("unchecked, checkable, release") << QRect(0, 0, 20, 20) - << QString("foo") << (int)(Qt::Unchecked) - << (int)(Qt::ItemIsEditable - |Qt::ItemIsSelectable - |Qt::ItemIsUserCheckable - |Qt::ItemIsEnabled - |Qt::ItemIsDragEnabled - |Qt::ItemIsDropEnabled) + << defaultFlags << true << (int)(QEvent::MouseButtonRelease) << (int)(Qt::LeftButton) @@ -1143,14 +1131,8 @@ void tst_QItemDelegate::editorEvent_data() QTest::newRow("unchecked, checkable, release, right button") << QRect(0, 0, 20, 20) - << QString("foo") << (int)(Qt::Unchecked) - << (int)(Qt::ItemIsEditable - |Qt::ItemIsSelectable - |Qt::ItemIsUserCheckable - |Qt::ItemIsEnabled - |Qt::ItemIsDragEnabled - |Qt::ItemIsDropEnabled) + << defaultFlags << true << (int)(QEvent::MouseButtonRelease) << (int)(Qt::RightButton) @@ -1159,14 +1141,8 @@ void tst_QItemDelegate::editorEvent_data() QTest::newRow("unchecked, checkable, release outside") << QRect(0, 0, 20, 20) - << QString("foo") << (int)(Qt::Unchecked) - << (int)(Qt::ItemIsEditable - |Qt::ItemIsSelectable - |Qt::ItemIsUserCheckable - |Qt::ItemIsEnabled - |Qt::ItemIsDragEnabled - |Qt::ItemIsDropEnabled) + << defaultFlags << false << (int)(QEvent::MouseButtonRelease) << (int)(Qt::LeftButton) @@ -1175,14 +1151,8 @@ void tst_QItemDelegate::editorEvent_data() QTest::newRow("unchecked, checkable, dblclick") << QRect(0, 0, 20, 20) - << QString("foo") << (int)(Qt::Unchecked) - << (int)(Qt::ItemIsEditable - |Qt::ItemIsSelectable - |Qt::ItemIsUserCheckable - |Qt::ItemIsEnabled - |Qt::ItemIsDragEnabled - |Qt::ItemIsDropEnabled) + << defaultFlags << true << (int)(QEvent::MouseButtonDblClick) << (int)(Qt::LeftButton) @@ -1191,15 +1161,8 @@ void tst_QItemDelegate::editorEvent_data() QTest::newRow("unchecked, tristate, release") << QRect(0, 0, 20, 20) - << QString("foo") << (int)(Qt::Unchecked) - << (int)(Qt::ItemIsEditable - |Qt::ItemIsSelectable - |Qt::ItemIsUserCheckable - |Qt::ItemIsTristate - |Qt::ItemIsEnabled - |Qt::ItemIsDragEnabled - |Qt::ItemIsDropEnabled) + << (int)(defaultFlags | Qt::ItemIsTristate) << true << (int)(QEvent::MouseButtonRelease) << (int)(Qt::LeftButton) @@ -1208,15 +1171,8 @@ void tst_QItemDelegate::editorEvent_data() QTest::newRow("partially checked, tristate, release") << QRect(0, 0, 20, 20) - << QString("foo") << (int)(Qt::PartiallyChecked) - << (int)(Qt::ItemIsEditable - |Qt::ItemIsSelectable - |Qt::ItemIsUserCheckable - |Qt::ItemIsTristate - |Qt::ItemIsEnabled - |Qt::ItemIsDragEnabled - |Qt::ItemIsDropEnabled) + << (int)(defaultFlags | Qt::ItemIsTristate) << true << (int)(QEvent::MouseButtonRelease) << (int)(Qt::LeftButton) @@ -1225,15 +1181,8 @@ void tst_QItemDelegate::editorEvent_data() QTest::newRow("checked, tristate, release") << QRect(0, 0, 20, 20) - << QString("foo") << (int)(Qt::Checked) - << (int)(Qt::ItemIsEditable - |Qt::ItemIsSelectable - |Qt::ItemIsUserCheckable - |Qt::ItemIsTristate - |Qt::ItemIsEnabled - |Qt::ItemIsDragEnabled - |Qt::ItemIsDropEnabled) + << (int)(defaultFlags | Qt::ItemIsTristate) << true << (int)(QEvent::MouseButtonRelease) << (int)(Qt::LeftButton) @@ -1244,7 +1193,6 @@ void tst_QItemDelegate::editorEvent_data() void tst_QItemDelegate::editorEvent() { QFETCH(QRect, rect); - QFETCH(QString, text); QFETCH(int, checkState); QFETCH(int, flags); QFETCH(bool, inCheck); @@ -1258,7 +1206,7 @@ void tst_QItemDelegate::editorEvent() QVERIFY(index.isValid()); QStandardItem *item = model.itemFromIndex(index); - item->setText(text); + item->setText("foo"); item->setCheckState((Qt::CheckState)checkState); item->setFlags((Qt::ItemFlags)flags); diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp index 6428bbba10..428b2f0c42 100644 --- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp @@ -123,7 +123,7 @@ private slots: void task258949_keypressHangup(); void QTBUG8086_currentItemChangedOnClick(); void QTBUG14363_completerWithAnyKeyPressedEditTriggers(); - + void mimeData(); protected slots: void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last) @@ -1082,6 +1082,9 @@ public: Q_UNUSED(item); return QListWidget::state() == QListWidget::EditingState; } + + using QListWidget::mimeData; + using QListWidget::indexFromItem; }; void tst_QListWidget::closeEditor() @@ -1662,7 +1665,57 @@ void tst_QListWidget::QTBUG14363_completerWithAnyKeyPressedEditTriggers() QCOMPARE(le->completer()->currentCompletion(), QString("completer")); } +void tst_QListWidget::mimeData() +{ + TestListWidget list; + + for (int x = 0; x < 10; ++x) { + QListWidgetItem *item = new QListWidgetItem(QStringLiteral("123")); + list.addItem(item); + } + + QList<QListWidgetItem *> tableWidgetItemList; + QModelIndexList modelIndexList; + + // do these checks more than once to ensure that the "cached indexes" work as expected + QVERIFY(!list.mimeData(tableWidgetItemList)); + QVERIFY(!list.model()->mimeData(modelIndexList)); + QVERIFY(!list.model()->mimeData(modelIndexList)); + QVERIFY(!list.mimeData(tableWidgetItemList)); + + tableWidgetItemList << list.item(1); + modelIndexList << list.indexFromItem(list.item(1)); + + QMimeData *data; + + QVERIFY(data = list.mimeData(tableWidgetItemList)); + delete data; + QVERIFY(data = list.model()->mimeData(modelIndexList)); + delete data; + + QVERIFY(data = list.model()->mimeData(modelIndexList)); + delete data; + + QVERIFY(data = list.mimeData(tableWidgetItemList)); + delete data; + + // check the saved data is actually the same + + QMimeData *data2; + + data = list.mimeData(tableWidgetItemList); + data2 = list.model()->mimeData(modelIndexList); + + const QString format = QStringLiteral("application/x-qabstractitemmodeldatalist"); + + QVERIFY(data->hasFormat(format)); + QVERIFY(data2->hasFormat(format)); + QVERIFY(data->data(format) == data2->data(format)); + + delete data; + delete data2; +} QTEST_MAIN(tst_QListWidget) #include "tst_qlistwidget.moc" diff --git a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp index 8335497c6c..de88e832aa 100644 --- a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp +++ b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp @@ -93,6 +93,7 @@ private slots: void task219380_removeLastRow(); void task262056_sortDuplicate(); void itemWithHeaderItems(); + void mimeData(); private: QTableWidget *testWidget; @@ -1497,5 +1498,72 @@ void tst_QTableWidget::itemWithHeaderItems() QCOMPARE(table.item(0, 1), static_cast<QTableWidgetItem *>(0)); } +class TestTableWidget : public QTableWidget +{ + Q_OBJECT +public: + TestTableWidget(int rows, int columns, QWidget *parent = 0) + : QTableWidget(rows, columns, parent) + { + } + + using QTableWidget::mimeData; + using QTableWidget::indexFromItem; +}; + +void tst_QTableWidget::mimeData() +{ + TestTableWidget table(10, 10); + + for (int x = 0; x < 10; ++x) { + for (int y = 0; y < 10; ++y) { + QTableWidgetItem *item = new QTableWidgetItem(QStringLiteral("123")); + table.setItem(y, x, item); + } + } + + QList<QTableWidgetItem *> tableWidgetItemList; + QModelIndexList modelIndexList; + + // do these checks more than once to ensure that the "cached indexes" work as expected + QVERIFY(!table.mimeData(tableWidgetItemList)); + QVERIFY(!table.model()->mimeData(modelIndexList)); + QVERIFY(!table.model()->mimeData(modelIndexList)); + QVERIFY(!table.mimeData(tableWidgetItemList)); + + tableWidgetItemList << table.item(1, 1); + modelIndexList << table.indexFromItem(table.item(1, 1)); + + QMimeData *data; + + QVERIFY(data = table.mimeData(tableWidgetItemList)); + delete data; + + QVERIFY(data = table.model()->mimeData(modelIndexList)); + delete data; + + QVERIFY(data = table.model()->mimeData(modelIndexList)); + delete data; + + QVERIFY(data = table.mimeData(tableWidgetItemList)); + delete data; + + // check the saved data is actually the same + + QMimeData *data2; + + data = table.mimeData(tableWidgetItemList); + data2 = table.model()->mimeData(modelIndexList); + + const QString format = QStringLiteral("application/x-qabstractitemmodeldatalist"); + + QVERIFY(data->hasFormat(format)); + QVERIFY(data2->hasFormat(format)); + QVERIFY(data->data(format) == data2->data(format)); + + delete data; + delete data2; +} + QTEST_MAIN(tst_QTableWidget) #include "tst_qtablewidget.moc" diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp index 1d6f577192..0691801553 100644 --- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp @@ -42,6 +42,7 @@ #include <qdebug.h> #include <qstring.h> #include <qshortcut.h> +#include <qscreen.h> class AccelForm; QT_BEGIN_NAMESPACE @@ -119,6 +120,7 @@ private slots: void keypressConsumption(); void unicodeCompare(); void context(); + void duplicatedShortcutOverride(); protected: static Qt::KeyboardModifiers toButtons( int key ); @@ -1082,6 +1084,36 @@ void tst_QShortcut::context() clearAllShortcuts(); } +// QTBUG-38986, do not generate duplicated QEvent::ShortcutOverride in event processing. +class OverrideCountingWidget : public QWidget +{ +public: + OverrideCountingWidget(QWidget *parent = 0) : QWidget(parent), overrideCount(0) {} + + int overrideCount; + + bool event(QEvent *e) Q_DECL_OVERRIDE + { + if (e->type() == QEvent::ShortcutOverride) + overrideCount++; + return QWidget::event(e); + } +}; + +void tst_QShortcut::duplicatedShortcutOverride() +{ + OverrideCountingWidget w; + w.setWindowTitle(Q_FUNC_INFO); + w.resize(200, 200); + w.move(QGuiApplication::primaryScreen()->availableGeometry().center() - QPoint(100, 100)); + w.show(); + QApplication::setActiveWindow(&w); + QVERIFY(QTest::qWaitForWindowActive(&w)); + QTest::keyPress(w.windowHandle(), Qt::Key_A); + QCoreApplication::processEvents(); + QCOMPARE(w.overrideCount, 1); +} + // ------------------------------------------------------------------ // Element Testing helper functions --------------------------------- // ------------------------------------------------------------------ @@ -1226,7 +1258,7 @@ void tst_QShortcut::testElement() setupShortcut(testWidget, txt, k1, k2, k3, k4); } else { sendKeyEvents(k1, c1, k2, c2, k3, c3, k4, c4); - QCOMPARE(currentResult, result); + QCOMPARE((int)currentResult, (int)result); } } diff --git a/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp b/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp index 917a00e6db..30b0b2b896 100644 --- a/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp +++ b/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp @@ -70,6 +70,7 @@ void tst_QWidgetMetaType::metaObject() QCOMPARE(QMetaType::metaObjectForType(qMetaTypeId<QWidget*>()), &QWidget::staticMetaObject); QCOMPARE(QMetaType::metaObjectForType(qMetaTypeId<QLabel*>()), &QLabel::staticMetaObject); QCOMPARE(QMetaType::metaObjectForType(qMetaTypeId<CustomWidget*>()), &CustomWidget::staticMetaObject); + QCOMPARE(QMetaType::metaObjectForType(qMetaTypeId<QSizePolicy>()), &QSizePolicy::staticMetaObject); } QTEST_MAIN(tst_QWidgetMetaType) diff --git a/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp b/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp index b18801220c..83e6b94db9 100644 --- a/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp +++ b/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp @@ -60,6 +60,8 @@ private slots: void viewportCrash(); void task214488_layoutDirection_data(); void task214488_layoutDirection(); + + void margins(); }; tst_QAbstractScrollArea::tst_QAbstractScrollArea() @@ -375,5 +377,22 @@ void tst_QAbstractScrollArea::patternBackground() QCOMPARE(image.pixel(QPoint(20,20)) , QColor(Qt::red).rgb()); } +class ScrollArea : public QAbstractScrollArea +{ +public: + using QAbstractScrollArea::setViewportMargins; + using QAbstractScrollArea::viewportMargins; +}; + +void tst_QAbstractScrollArea::margins() +{ + ScrollArea area; + QCOMPARE(area.viewportMargins(), QMargins()); + + QMargins margins(10, 20, 30, 40); + area.setViewportMargins(margins); + QCOMPARE(area.viewportMargins(), margins); +} + QTEST_MAIN(tst_QAbstractScrollArea) #include "tst_qabstractscrollarea.moc" diff --git a/tests/auto/widgets/widgets/qframe/.gitignore b/tests/auto/widgets/widgets/qframe/.gitignore new file mode 100644 index 0000000000..d01744a6bd --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/.gitignore @@ -0,0 +1 @@ +tst_qframe diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_0.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_0.png Binary files differnew file mode 100644 index 0000000000..f1d6392779 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_1.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_1.png Binary files differnew file mode 100644 index 0000000000..f1d6392779 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_2.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_2.png Binary files differnew file mode 100644 index 0000000000..f1d6392779 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_0_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_0.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_0.png Binary files differnew file mode 100644 index 0000000000..0cc9090e3b --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_1.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_1.png Binary files differnew file mode 100644 index 0000000000..0cc9090e3b --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_2.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_2.png Binary files differnew file mode 100644 index 0000000000..0cc9090e3b --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_1_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_0.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_0.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_1.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_1.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_2.png b/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_2.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_noshadow_2_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_0_0.png b/tests/auto/widgets/widgets/qframe/images/box_plain_0_0.png Binary files differnew file mode 100644 index 0000000000..f1d6392779 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_plain_0_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_0_1.png b/tests/auto/widgets/widgets/qframe/images/box_plain_0_1.png Binary files differnew file mode 100644 index 0000000000..f1d6392779 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_plain_0_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_0_2.png b/tests/auto/widgets/widgets/qframe/images/box_plain_0_2.png Binary files differnew file mode 100644 index 0000000000..f1d6392779 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_plain_0_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_1_0.png b/tests/auto/widgets/widgets/qframe/images/box_plain_1_0.png Binary files differnew file mode 100644 index 0000000000..0cc9090e3b --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_plain_1_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_1_1.png b/tests/auto/widgets/widgets/qframe/images/box_plain_1_1.png Binary files differnew file mode 100644 index 0000000000..0cc9090e3b --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_plain_1_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_1_2.png b/tests/auto/widgets/widgets/qframe/images/box_plain_1_2.png Binary files differnew file mode 100644 index 0000000000..0cc9090e3b --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_plain_1_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_2_0.png b/tests/auto/widgets/widgets/qframe/images/box_plain_2_0.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_plain_2_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_2_1.png b/tests/auto/widgets/widgets/qframe/images/box_plain_2_1.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_plain_2_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_plain_2_2.png b/tests/auto/widgets/widgets/qframe/images/box_plain_2_2.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_plain_2_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_0_0.png b/tests/auto/widgets/widgets/qframe/images/box_raised_0_0.png Binary files differnew file mode 100644 index 0000000000..f1d6392779 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_raised_0_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_0_1.png b/tests/auto/widgets/widgets/qframe/images/box_raised_0_1.png Binary files differnew file mode 100644 index 0000000000..b2ab941d30 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_raised_0_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_0_2.png b/tests/auto/widgets/widgets/qframe/images/box_raised_0_2.png Binary files differnew file mode 100644 index 0000000000..21ebe53eff --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_raised_0_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_1_0.png b/tests/auto/widgets/widgets/qframe/images/box_raised_1_0.png Binary files differnew file mode 100644 index 0000000000..4f097cee48 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_raised_1_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_1_1.png b/tests/auto/widgets/widgets/qframe/images/box_raised_1_1.png Binary files differnew file mode 100644 index 0000000000..86f9ed6186 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_raised_1_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_1_2.png b/tests/auto/widgets/widgets/qframe/images/box_raised_1_2.png Binary files differnew file mode 100644 index 0000000000..51a7899d05 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_raised_1_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_2_0.png b/tests/auto/widgets/widgets/qframe/images/box_raised_2_0.png Binary files differnew file mode 100644 index 0000000000..8c3769c32d --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_raised_2_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_2_1.png b/tests/auto/widgets/widgets/qframe/images/box_raised_2_1.png Binary files differnew file mode 100644 index 0000000000..81e0c2a152 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_raised_2_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_raised_2_2.png b/tests/auto/widgets/widgets/qframe/images/box_raised_2_2.png Binary files differnew file mode 100644 index 0000000000..107272d0b9 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_raised_2_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_0_0.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_0_0.png Binary files differnew file mode 100644 index 0000000000..f1d6392779 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_0_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_0_1.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_0_1.png Binary files differnew file mode 100644 index 0000000000..b2ab941d30 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_0_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_0_2.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_0_2.png Binary files differnew file mode 100644 index 0000000000..21ebe53eff --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_0_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_1_0.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_1_0.png Binary files differnew file mode 100644 index 0000000000..6905baa1fd --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_1_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_1_1.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_1_1.png Binary files differnew file mode 100644 index 0000000000..9d5440b3aa --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_1_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_1_2.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_1_2.png Binary files differnew file mode 100644 index 0000000000..17eb7f59c0 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_1_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_2_0.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_2_0.png Binary files differnew file mode 100644 index 0000000000..a6ccd54a39 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_2_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_2_1.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_2_1.png Binary files differnew file mode 100644 index 0000000000..3736bf6c99 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_2_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/box_sunken_2_2.png b/tests/auto/widgets/widgets/qframe/images/box_sunken_2_2.png Binary files differnew file mode 100644 index 0000000000..5750751c58 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/box_sunken_2_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_0.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_1.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_2.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_0_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_0.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_1.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_2.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_1_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_0.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_1.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_2.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_noshadow_2_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_0.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_1.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_2.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_0_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_0.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_1.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_2.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_1_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_0.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_1.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_2.png Binary files differnew file mode 100644 index 0000000000..61f683df52 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_plain_2_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_0.png Binary files differnew file mode 100644 index 0000000000..a75833c89c --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_1.png Binary files differnew file mode 100644 index 0000000000..a75833c89c --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_2.png Binary files differnew file mode 100644 index 0000000000..a75833c89c --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_0_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_0.png Binary files differnew file mode 100644 index 0000000000..a75833c89c --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_1.png Binary files differnew file mode 100644 index 0000000000..a75833c89c --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_2.png Binary files differnew file mode 100644 index 0000000000..a75833c89c --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_1_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_0.png Binary files differnew file mode 100644 index 0000000000..a75833c89c --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_1.png Binary files differnew file mode 100644 index 0000000000..a75833c89c --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_2.png Binary files differnew file mode 100644 index 0000000000..a75833c89c --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_raised_2_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_0.png Binary files differnew file mode 100644 index 0000000000..d656ac56f0 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_1.png Binary files differnew file mode 100644 index 0000000000..d656ac56f0 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_2.png Binary files differnew file mode 100644 index 0000000000..d656ac56f0 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_0_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_0.png Binary files differnew file mode 100644 index 0000000000..d656ac56f0 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_1.png Binary files differnew file mode 100644 index 0000000000..d656ac56f0 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_2.png Binary files differnew file mode 100644 index 0000000000..d656ac56f0 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_1_2.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_0.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_0.png Binary files differnew file mode 100644 index 0000000000..d656ac56f0 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_0.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_1.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_1.png Binary files differnew file mode 100644 index 0000000000..d656ac56f0 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_1.png diff --git a/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_2.png b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_2.png Binary files differnew file mode 100644 index 0000000000..d656ac56f0 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/images/winpanel_sunken_2_2.png diff --git a/tests/auto/widgets/widgets/qframe/qframe.pro b/tests/auto/widgets/widgets/qframe/qframe.pro new file mode 100644 index 0000000000..1da7eb1d11 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/qframe.pro @@ -0,0 +1,8 @@ +CONFIG += testcase +TARGET = tst_qframe + +QT += testlib widgets + +SOURCES += tst_qframe.cpp + +TESTDATA += images/* diff --git a/tests/auto/widgets/widgets/qframe/tst_qframe.cpp b/tests/auto/widgets/widgets/qframe/tst_qframe.cpp new file mode 100644 index 0000000000..ee6b3313a6 --- /dev/null +++ b/tests/auto/widgets/widgets/qframe/tst_qframe.cpp @@ -0,0 +1,185 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QTest> +#include <QFrame> +#include <QStyleOptionFrame> +#include <QPixmap> +#include <QStyle> +#include <QStyleFactory> + +class tst_QFrame : public QObject +{ + Q_OBJECT +private slots: + void testDefaults(); + void testInitStyleOption_data(); + void testInitStyleOption(); + void testPainting_data(); + void testPainting(); +}; + +Q_DECLARE_METATYPE(QFrame::Shape) +Q_DECLARE_METATYPE(QFrame::Shadow) + +void tst_QFrame::testDefaults() +{ + QFrame frame; + QCOMPARE(frame.frameStyle(), int(QFrame::NoFrame | QFrame::Plain)); + frame.setFrameShape(QFrame::Box); + QCOMPARE(frame.frameStyle(), int(QFrame::Box | QFrame::Plain)); + frame.setFrameStyle(QFrame::Box); // no shadow specified! + QCOMPARE(frame.frameStyle(), int(QFrame::Box)); +} + +static void provideFrameData() +{ + QTest::addColumn<QString>("basename"); + QTest::addColumn<int>("lineWidth"); + QTest::addColumn<int>("midLineWidth"); + QTest::addColumn<QFrame::Shape>("shape"); + QTest::addColumn<QFrame::Shadow>("shadow"); + + for (int lineWidth = 0; lineWidth < 3; ++lineWidth) { + for (int midLineWidth = 0; midLineWidth < 3; ++midLineWidth) { + QTest::newRow(qPrintable(QStringLiteral("box_noshadow_%1_%2").arg(lineWidth).arg(midLineWidth))) + << "box_noshadow" << lineWidth << midLineWidth << QFrame::Box << (QFrame::Shadow)0; + QTest::newRow(qPrintable(QStringLiteral("box_plain_%1_%2").arg(lineWidth).arg(midLineWidth))) + << "box_plain" << lineWidth << midLineWidth << QFrame::Box << QFrame::Plain; + QTest::newRow(qPrintable(QStringLiteral("box_raised_%1_%2").arg(lineWidth).arg(midLineWidth))) + << "box_raised" << lineWidth << midLineWidth << QFrame::Box << QFrame::Raised; + QTest::newRow(qPrintable(QStringLiteral("box_sunken_%1_%2").arg(lineWidth).arg(midLineWidth))) + << "box_sunken" << lineWidth << midLineWidth << QFrame::Box << QFrame::Sunken; + + QTest::newRow(qPrintable(QStringLiteral("winpanel_noshadow_%1_%2").arg(lineWidth).arg(midLineWidth))) + << "winpanel_noshadow" << lineWidth << midLineWidth << QFrame::WinPanel << (QFrame::Shadow)0; + QTest::newRow(qPrintable(QStringLiteral("winpanel_plain_%1_%2").arg(lineWidth).arg(midLineWidth))) + << "winpanel_plain" << lineWidth << midLineWidth << QFrame::WinPanel << QFrame::Plain; + QTest::newRow(qPrintable(QStringLiteral("winpanel_raised_%1_%2").arg(lineWidth).arg(midLineWidth))) + << "winpanel_raised" << lineWidth << midLineWidth << QFrame::WinPanel << QFrame::Raised; + QTest::newRow(qPrintable(QStringLiteral("winpanel_sunken_%1_%2").arg(lineWidth).arg(midLineWidth))) + << "winpanel_sunken" << lineWidth << midLineWidth << QFrame::WinPanel << QFrame::Sunken; + } + } +} + +class Frame : public QFrame +{ +public: + using QFrame::initStyleOption; +}; + +void tst_QFrame::testInitStyleOption_data() +{ + provideFrameData(); +} + +void tst_QFrame::testInitStyleOption() +{ + QFETCH(QString, basename); + QFETCH(int, lineWidth); + QFETCH(int, midLineWidth); + QFETCH(QFrame::Shape, shape); + QFETCH(QFrame::Shadow, shadow); + + Frame frame; + frame.setFrameStyle(shape | shadow); + frame.setLineWidth(lineWidth); + frame.setMidLineWidth(midLineWidth); + frame.resize(16, 16); + + QStyleOptionFrame styleOption; + frame.initStyleOption(&styleOption); + + switch (shape) { + case QFrame::Box: + case QFrame::Panel: + case QFrame::StyledPanel: + case QFrame::HLine: + case QFrame::VLine: + QCOMPARE(styleOption.lineWidth, lineWidth); + QCOMPARE(styleOption.midLineWidth, midLineWidth); + break; + + case QFrame::NoFrame: + case QFrame::WinPanel: + QCOMPARE(styleOption.lineWidth, frame.frameWidth()); + QCOMPARE(styleOption.midLineWidth, 0); + break; + } + + QCOMPARE(styleOption.features, QStyleOptionFrame::None); + QCOMPARE(styleOption.frameShape, shape); + if (shadow == QFrame::Sunken) + QVERIFY(styleOption.state & QStyle::State_Sunken); + else if (shadow == QFrame::Raised) + QVERIFY(styleOption.state & QStyle::State_Raised); +} + +QT_BEGIN_NAMESPACE +Q_GUI_EXPORT QPalette qt_fusionPalette(); +QT_END_NAMESPACE + +void tst_QFrame::testPainting_data() +{ + provideFrameData(); +} + +void tst_QFrame::testPainting() +{ + QFETCH(QString, basename); + QFETCH(int, lineWidth); + QFETCH(int, midLineWidth); + QFETCH(QFrame::Shape, shape); + QFETCH(QFrame::Shadow, shadow); + + QFrame frame; + frame.setStyle(QStyleFactory::create(QStringLiteral("fusion"))); + frame.setPalette(qt_fusionPalette()); + frame.setFrameStyle(shape | shadow); + frame.setLineWidth(lineWidth); + frame.setMidLineWidth(midLineWidth); + frame.resize(16, 16); + + const QPixmap pixmap = frame.grab(); + + const QString referenceFilePath = QFINDTESTDATA(QStringLiteral("images/%1_%2_%3.png").arg(basename).arg(lineWidth).arg(midLineWidth)); + const QPixmap referencePixmap(referenceFilePath); + QVERIFY2(!referencePixmap.isNull(), qPrintable(QStringLiteral("Could not load reference pixmap %1").arg(referenceFilePath))); + QCOMPARE(pixmap, referencePixmap); +} + +QTEST_MAIN(tst_QFrame) + +#include "tst_qframe.moc" diff --git a/tests/auto/widgets/widgets/widgets.pro b/tests/auto/widgets/widgets/widgets.pro index 423b3952d4..0651583867 100644 --- a/tests/auto/widgets/widgets/widgets.pro +++ b/tests/auto/widgets/widgets/widgets.pro @@ -16,6 +16,7 @@ SUBDIRS=\ qdoublespinbox \ qfocusframe \ qfontcombobox \ + qframe \ qgroupbox \ qkeysequenceedit \ qlabel \ |