diff options
Diffstat (limited to 'tests/auto/widgets/widgets')
81 files changed, 246 insertions, 3 deletions
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/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 23d0ffd2d2..0873c6bbb1 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -1576,6 +1576,35 @@ void tst_QComboBox::setModel() box.setModel(new QStandardItemModel(2,1, &box)); QCOMPARE(box.currentIndex(), 0); QVERIFY(box.model() != oldModel); + + // set a new root index + QModelIndex rootModelIndex; + rootModelIndex = box.model()->index(0, 0); + QVERIFY(rootModelIndex.isValid()); + box.setRootModelIndex(rootModelIndex); + QCOMPARE(box.rootModelIndex(), rootModelIndex); + + // change the model, ensure that the root index gets reset + oldModel = box.model(); + box.setModel(new QStandardItemModel(2, 1, &box)); + QCOMPARE(box.currentIndex(), 0); + QVERIFY(box.model() != oldModel); + QVERIFY(box.rootModelIndex() != rootModelIndex); + QVERIFY(box.rootModelIndex() == QModelIndex()); + + // check that setting the very same model doesn't move the current item + box.setCurrentIndex(1); + QCOMPARE(box.currentIndex(), 1); + box.setModel(box.model()); + QCOMPARE(box.currentIndex(), 1); + + // check that setting the very same model doesn't move the root index + rootModelIndex = box.model()->index(0, 0); + QVERIFY(rootModelIndex.isValid()); + box.setRootModelIndex(rootModelIndex); + QCOMPARE(box.rootModelIndex(), rootModelIndex); + box.setModel(box.model()); + QCOMPARE(box.rootModelIndex(), rootModelIndex); } void tst_QComboBox::setCustomModelAndView() 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/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index ff9bc7c4a2..66accce0a2 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -487,7 +487,7 @@ void tst_QMdiArea::subWindowActivated2() // Check that we only emit _one_ signal and the active window // is unchanged after hide/show. mdiArea.hide(); -#ifdef Q_WS_X11 +#ifdef Q_DEAD_CODE_FROM_QT4_X11 qt_x11_wait_for_window_manager(&mdiArea); #endif QTest::qWait(100); diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index 9f09a57a5a..82f7285267 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -56,7 +56,7 @@ #include "../../../qtest-config.h" QT_BEGIN_NAMESPACE -#if !defined(Q_WS_WIN) +#if !defined(Q_DEAD_CODE_FROM_QT4_WIN) extern bool qt_tab_all_widgets(); #endif QT_END_NAMESPACE diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp index 3dfb08406f..4e3d45829b 100644 --- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp +++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp @@ -768,7 +768,7 @@ void tst_QSplitter::task169702_sizes() QTest::qWait(100); testW->m_iFactor++; testW->updateGeometry(); - QTest::qWait(500);//100 is too fast for Maemo + QTest::qWait(500); //Make sure the minimimSizeHint is respected QCOMPARE(testW->size().height(), testW->minimumSizeHint().height()); 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 \ |